Browse Source

REVIEWED: `glInternalFormat` is unsigned and actually, `rlGetGlTextureFormats()` returns 0 if fails

pull/3350/head
Ray 1 year ago
parent
commit
557aeff253
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      src/rlgl.h

+ 4
- 4
src/rlgl.h View File

@ -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 != o">-1)
if (glInternalFormat != mi">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 != o">-1)
if (glInternalFormat != mi">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 != o">-1) && (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB))
if ((glInternalFormat != mi">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 != o">-1) && (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB))
if ((glInternalFormat != mi">0) && (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB))
{
pixels = RL_MALLOC(size);
glGetTexImage(GL_TEXTURE_2D, 0, glFormat, glType, pixels);

Loading…
Cancel
Save