mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-06-08 17:42:05 +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:
parent
cfd4a80bdc
commit
417972bea1
1 changed files with 6 additions and 0 deletions
|
@ -61,6 +61,12 @@ Texture::~Texture()
|
|||
|
||||
void Texture::readRGBA(unsigned char *pixels) const
|
||||
{
|
||||
if(!gltexid)
|
||||
{
|
||||
memset(pixels, 0xff, sizeBytes());
|
||||
return;
|
||||
}
|
||||
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
glBindTexture(GL_TEXTURE_2D, gltexid);
|
||||
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||
|
|
Loading…
Add table
Reference in a new issue