diff options
| author | Ray <[email protected]> | 2023-09-22 11:59:52 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2023-09-22 11:59:52 +0200 |
| commit | 557aeff253255a7ce2aac3b1872aeefba6ff2a51 (patch) | |
| tree | aa31f6cf7077a2a904b47377bf3e359b2194d881 /src | |
| parent | a3a5aa7c639410f4ff8ed776d590f952653f5ed1 (diff) | |
| download | raylib-557aeff253255a7ce2aac3b1872aeefba6ff2a51.tar.gz raylib-557aeff253255a7ce2aac3b1872aeefba6ff2a51.zip | |
REVIEWED: `glInternalFormat` is unsigned and actually, `rlGetGlTextureFormats()` returns 0 if fails
Diffstat (limited to 'src')
| -rw-r--r-- | src/rlgl.h | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -3012,7 +3012,7 @@ unsigned int rlLoadTexture(const void *data, int width, int height, int format, TRACELOGD("TEXTURE: Load mipmap level %i (%i x %i), size: %i, offset: %i", i, mipWidth, mipHeight, mipSize, mipOffset); - if (glInternalFormat != -1) + if (glInternalFormat != 0) { if (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB) glTexImage2D(GL_TEXTURE_2D, i, glInternalFormat, mipWidth, mipHeight, 0, glFormat, glType, dataPtr); #if !defined(GRAPHICS_API_OPENGL_11) @@ -3166,7 +3166,7 @@ unsigned int rlLoadTextureCubemap(const void *data, int size, int format) unsigned int glInternalFormat, glFormat, glType; rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType); - if (glInternalFormat != -1) + if (glInternalFormat != 0) { // Load cubemap faces for (unsigned int i = 0; i < 6; i++) @@ -3234,7 +3234,7 @@ void rlUpdateTexture(unsigned int id, int offsetX, int offsetY, int width, int h unsigned int glInternalFormat, glFormat, glType; rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType); - if ((glInternalFormat != -1) && (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB)) + if ((glInternalFormat != 0) && (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB)) { glTexSubImage2D(GL_TEXTURE_2D, 0, offsetX, offsetY, width, height, glFormat, glType, data); } @@ -3378,7 +3378,7 @@ void *rlReadTexturePixels(unsigned int id, int width, int height, int format) rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType); unsigned int size = rlGetPixelDataSize(width, height, format); - if ((glInternalFormat != -1) && (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB)) + if ((glInternalFormat != 0) && (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB)) { pixels = RL_MALLOC(size); glGetTexImage(GL_TEXTURE_2D, 0, glFormat, glType, pixels); |
