Skip to content

Commit

Permalink
Fix crashes in the unit test environment, where the use of glGenerate…
Browse files Browse the repository at this point in the history
…Mipmap isn't supported (no openGL 3.0+)
  • Loading branch information
codereader committed Aug 8, 2021
1 parent eda8485 commit 9e73861
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libs/RGBAImage.h
Expand Up @@ -72,7 +72,12 @@ class RGBAImage :
glTexImage2D(GL_TEXTURE_2D, 0, format, static_cast<GLint>(getWidth()),
static_cast<GLint>(getHeight()), 0, GL_RGBA,
GL_UNSIGNED_BYTE, getPixels());
glGenerateMipmap(GL_TEXTURE_2D);

// glGenerateMipMaps is supported in openGL 3.0+
if (GLEW_VERSION_3_0)
{
glGenerateMipmap(GL_TEXTURE_2D);
}

// Un-bind the texture
glBindTexture(GL_TEXTURE_2D, 0);
Expand Down

0 comments on commit 9e73861

Please sign in to comment.