REVIEWED: rlGenTextureMipmaps()
, GPU generation only
This commit is contained in:
parent
5149da5719
commit
f68bb8c707
1 changed files with 4 additions and 2 deletions
|
@ -3248,6 +3248,7 @@ void rlUnloadTexture(unsigned int id)
|
||||||
// NOTE: Only supports GPU mipmap generation
|
// NOTE: Only supports GPU mipmap generation
|
||||||
void rlGenTextureMipmaps(unsigned int id, int width, int height, int format, int *mipmaps)
|
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);
|
glBindTexture(GL_TEXTURE_2D, id);
|
||||||
|
|
||||||
// Check if texture is power-of-two (POT)
|
// 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)) &&
|
if (((width > 0) && ((width & (width - 1)) == 0)) &&
|
||||||
((height > 0) && ((height & (height - 1)) == 0))) texIsPOT = true;
|
((height > 0) && ((height & (height - 1)) == 0))) texIsPOT = true;
|
||||||
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
|
||||||
if ((texIsPOT) || (RLGL.ExtSupported.texNPOT))
|
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
|
//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));
|
*mipmaps = 1 + (int)floor(log(MAX(width, height))/log(2));
|
||||||
TRACELOG(RL_LOG_INFO, "TEXTURE: [ID %i] Mipmaps generated automatically, total: %i", id, *mipmaps);
|
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);
|
else TRACELOG(RL_LOG_WARNING, "TEXTURE: [ID %i] Failed to generate mipmaps", id);
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
#else
|
||||||
|
TRACELOG(RL_LOG_WARNING, "TEXTURE: [ID %i] GPU mipmap generation not supported", id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue