1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-06-08 09:31:58 +00:00

fix GL error with non-loaded texture

This was typically reported as a shader error since this is one of the
few places actually using glGetError().
This commit is contained in:
fgenesis 2025-05-30 01:52:53 +02:00
parent cfd4a80bdc
commit 417972bea1

View file

@ -61,6 +61,12 @@ Texture::~Texture()
void Texture::readRGBA(unsigned char *pixels) const void Texture::readRGBA(unsigned char *pixels) const
{ {
if(!gltexid)
{
memset(pixels, 0xff, sizeBytes());
return;
}
glPixelStorei(GL_PACK_ALIGNMENT, 1); glPixelStorei(GL_PACK_ALIGNMENT, 1);
glBindTexture(GL_TEXTURE_2D, gltexid); glBindTexture(GL_TEXTURE_2D, gltexid);
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels); glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);