summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRay <[email protected]>2023-01-24 17:17:25 +0100
committerRay <[email protected]>2023-01-24 17:17:25 +0100
commitf68bb8c7077a080cd878c3887cab1b4950b2acca (patch)
tree06f0444bb6c69c03a7b11b016116333b002ac53d /src
parent5149da57195df8bfe9adb9717e17043623bc621f (diff)
downloadraylib-f68bb8c7077a080cd878c3887cab1b4950b2acca.tar.gz
raylib-f68bb8c7077a080cd878c3887cab1b4950b2acca.zip
REVIEWED: `rlGenTextureMipmaps()`, GPU generation only
Diffstat (limited to 'src')
-rw-r--r--src/rlgl.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/rlgl.h b/src/rlgl.h
index 12f62771..2f1847e0 100644
--- a/src/rlgl.h
+++ b/src/rlgl.h
@@ -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
}