Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log warnings on missing images and GL functions #157

Merged
merged 1 commit into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions share/geom.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@ void back_init(const char *name)
{
struct mtrl *mp = mtrl_get(back.base.mtrls[0]);
mp->o = make_image_from_file(name, IF_MIPMAP);
if (!mp->o)
log_printf("failed to load background image \"%s\"\n", name);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
back_state = 1;
}
Expand Down
10 changes: 6 additions & 4 deletions share/glext.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ int glext_assert(const char *ext)

/*---------------------------------------------------------------------------*/

#define SDL_GL_GFPA(fun, str) do { \
ptr = SDL_GL_GetProcAddress(str); \
memcpy(&fun, &ptr, sizeof (void *)); \
#define SDL_GL_GFPA(fun, str) do { \
ptr = SDL_GL_GetProcAddress(str); \
if (!ptr) \
log_printf("Missing OpenGL function %s\n", str); \
memcpy(&fun, &ptr, sizeof (void *)); \
} while(0)

/*---------------------------------------------------------------------------*/
Expand All @@ -111,7 +113,7 @@ static void log_opengl(void)
log_printf("GL vendor: %s\n"
"GL renderer: %s\n"
"GL version: %s\n"
"GL extensions: %s",
"GL extensions: %s\n",
glGetString(GL_VENDOR),
glGetString(GL_RENDERER),
glGetString(GL_VERSION),
Expand Down
6 changes: 4 additions & 2 deletions share/mtrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ static void load_mtrl_objects(struct mtrl *mp)
{
/* Make sure not to leak an already loaded object. */

if (mp->o)
if (mp->o || mp->base.f[0] == '\0')
return;

/* Load the texture. */

if ((mp->o = find_texture(_(mp->base.f))))
if ((mp->o = find_texture(_(mp->base.f)))) /* Why is the _() needed here? */
{
/* Set the texture to clamp or repeat based on material type. */

Expand All @@ -123,6 +123,8 @@ static void load_mtrl_objects(struct mtrl *mp)
else
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
}
else
log_printf("failed to load texture \"%s\"\n", mp->base.f);
}

/*
Expand Down