(zahnrad) Add HAVE_OPENGL ifdef

This commit is contained in:
twinaphex 2016-03-22 05:52:46 +01:00
parent 1af81201a0
commit 2e11895ef9

View File

@ -26,6 +26,7 @@ struct zr_image zr_common_image_load(const char *filename)
unsigned char *data = stbi_load(filename, &x, &y, &n, 0);
if (!data) printf("Failed to load image: %s\n", filename);
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES)
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
@ -34,6 +35,8 @@ struct zr_image zr_common_image_load(const char *filename)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, x, y, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
glGenerateMipmap(GL_TEXTURE_2D);
#endif
stbi_image_free(data);
return zr_image_id((int)tex);
}