mirror of https://github.com/buggins/dlangui.git
Scene3d Texture colors fixed
This commit is contained in:
parent
8d882659e3
commit
156ce94f37
|
@ -970,17 +970,29 @@ class ColorDrawBuf : ColorDrawBufBase {
|
|||
fill(0xFFFFFFFF);
|
||||
drawRescaled(Rect(0, 0, dx, dy), v, Rect(0, 0, v.width, v.height));
|
||||
}
|
||||
|
||||
void invertAlpha() {
|
||||
foreach(ref pixel; _buf)
|
||||
pixel ^= 0xFF000000;
|
||||
}
|
||||
|
||||
void invertByteOrder() {
|
||||
foreach(pixel; _buf) {
|
||||
foreach(ref pixel; _buf) {
|
||||
pixel = (pixel & 0xFF00FF00) |
|
||||
((pixel & 0xFF0000) >> 16) |
|
||||
((pixel & 0xFF) << 16);
|
||||
}
|
||||
}
|
||||
|
||||
// for passing of image to OpenGL texture
|
||||
void invertAlphaAndByteOrder() {
|
||||
foreach(ref pixel; _buf) {
|
||||
pixel = ((pixel & 0xFF00FF00) |
|
||||
((pixel & 0xFF0000) >> 16) |
|
||||
((pixel & 0xFF) << 16));
|
||||
pixel ^= 0xFF000000;
|
||||
}
|
||||
}
|
||||
override uint * scanLine(int y) {
|
||||
if (y >= 0 && y < _dy)
|
||||
return _buf.ptr + _dx * y;
|
||||
|
|
|
@ -852,14 +852,14 @@ static class GLTexture : RefCountedObject {
|
|||
return;
|
||||
}
|
||||
uint * pixels = buf.scanLine(0);
|
||||
buf.invertAlpha();
|
||||
buf.invertAlphaAndByteOrder();
|
||||
if (!glSupport.setTextureImage(_texture, buf.width, buf.height, cast(ubyte*)pixels, mipmapLevels)) {
|
||||
destroy(_texture);
|
||||
_texture = null;
|
||||
buf.invertAlpha();
|
||||
buf.invertAlphaAndByteOrder();
|
||||
return;
|
||||
}
|
||||
buf.invertAlpha();
|
||||
buf.invertAlphaAndByteOrder();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue