mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-25 01:20:37 +00:00
hyperweb: loadTextureGL() now works correctly
This commit is contained in:
parent
98f6851288
commit
b80583cf08
@ -76,10 +76,16 @@ bool texture_data::loadTextureGL() {
|
|||||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
|
||||||
|
|
||||||
|
// BGRA may be not supported in the web version
|
||||||
|
if(ISWEB) for(auto& p: texture_pixels) swap(part(p, 0), part(p, 2));
|
||||||
|
|
||||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, twidth, twidth, 0,
|
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, twidth, twidth, 0,
|
||||||
|
ISWEB ? GL_RGBA : GL_BGRA, GL_UNSIGNED_BYTE,
|
||||||
GL_BGRA, GL_UNSIGNED_BYTE,
|
GL_BGRA, GL_UNSIGNED_BYTE,
|
||||||
&texture_pixels[0] );
|
&texture_pixels[0] );
|
||||||
|
|
||||||
|
if(ISWEB) for(auto& p: texture_pixels) swap(part(p, 0), part(p, 2));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user