fix: use rlGetPixelDataSize in rlgl.h (#6024)

This commit is contained in:
Leonardo Gomes
2026-07-27 11:29:32 -03:00
committed by GitHub
parent 3ea8b9298f
commit de24a6c1eb

View File

@@ -3755,7 +3755,7 @@ void *rlReadTexturePixels(unsigned int id, int width, int height, int format)
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
#else
// Reading data as original texture format, in some platforms (RPI, Wasm) it works
pixels = (unsigned char *)RL_MALLOC(GetPixelDataSize(width, height, format));
pixels = (unsigned char *)RL_MALLOC(rlGetPixelDataSize(width, height, format));
unsigned int glInternalFormat = 0, glFormat = 0, glType = 0;
rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType);
glReadPixels(0, 0, width, height, glFormat, glType, pixels);