|
|
@ -3248,6 +3248,7 @@ void rlUnloadTexture(unsigned int id) |
|
|
|
// NOTE: Only supports GPU mipmap generation |
|
|
|
void rlGenTextureMipmaps(unsigned int id, int width, int height, int format, int *mipmaps) |
|
|
|
{ |
|
|
|
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) |
|
|
|
glBindTexture(GL_TEXTURE_2D, id); |
|
|
|
|
|
|
|
// Check if texture is power-of-two (POT) |
|
|
@ -3256,7 +3257,6 @@ void rlGenTextureMipmaps(unsigned int id, int width, int height, int format, int |
|
|
|
if (((width > 0) && ((width & (width - 1)) == 0)) && |
|
|
|
((height > 0) && ((height & (height - 1)) == 0))) texIsPOT = true; |
|
|
|
|
|
|
|
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) |
|
|
|
if ((texIsPOT) || (RLGL.ExtSupported.texNPOT)) |
|
|
|
{ |
|
|
|
//glHint(GL_GENERATE_MIPMAP_HINT, GL_DONT_CARE); // Hint for mipmaps generation algorithm: GL_FASTEST, GL_NICEST, GL_DONT_CARE |
|
|
@ -3268,10 +3268,12 @@ void rlGenTextureMipmaps(unsigned int id, int width, int height, int format, int |
|
|
|
*mipmaps = 1 + (int)floor(log(MAX(width, height))/log(2)); |
|
|
|
TRACELOG(RL_LOG_INFO, "TEXTURE: [ID %i] Mipmaps generated automatically, total: %i", id, *mipmaps); |
|
|
|
} |
|
|
|
#endif |
|
|
|
else TRACELOG(RL_LOG_WARNING, "TEXTURE: [ID %i] Failed to generate mipmaps", id); |
|
|
|
|
|
|
|
glBindTexture(GL_TEXTURE_2D, 0); |
|
|
|
#else |
|
|
|
TRACELOG(RL_LOG_WARNING, "TEXTURE: [ID %i] GPU mipmap generation not supported", id); |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|