summaryrefslogtreecommitdiff
path: root/LayerManagerPlugins
diff options
context:
space:
mode:
authorMichael Schuldt <michael.schuldt@bmw-carit.de>2011-07-12 14:11:11 +0200
committerMichael Schuldt <michael.schuldt@bmw-carit.de>2011-07-12 14:11:11 +0200
commit1c3dae8c758e1fe1c483ffa55529687013217794 (patch)
treef50e081777564040de2b5bc173fe81c6d4b2437c /LayerManagerPlugins
parent45763692e8d89043b88dde071c31313b82b3f09f (diff)
downloadlayer_management-1c3dae8c758e1fe1c483ffa55529687013217794.tar.gz
Fixes issue with native X windows
- correctly displayed if the surface has the RGBA pixformat
Diffstat (limited to 'LayerManagerPlugins')
-rw-r--r--LayerManagerPlugins/Renderers/Graphic/src/TextureBinders/X11CopyGLX.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/LayerManagerPlugins/Renderers/Graphic/src/TextureBinders/X11CopyGLX.cpp b/LayerManagerPlugins/Renderers/Graphic/src/TextureBinders/X11CopyGLX.cpp
index e785f64..272d3d5 100644
--- a/LayerManagerPlugins/Renderers/Graphic/src/TextureBinders/X11CopyGLX.cpp
+++ b/LayerManagerPlugins/Renderers/Graphic/src/TextureBinders/X11CopyGLX.cpp
@@ -50,10 +50,28 @@ bool X11CopyGLX::bindSurfaceTexture(Surface* surface)
glBindTexture(GL_TEXTURE_2D, nativeSurface->texture);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- if (xim->depth == 24)
+ if ( surface->getPixelFormat() == PIXELFORMAT_RGB888 )
{
targetType = GL_BGR;
sourceType = GL_RGB;
+ }
+ else if ( surface->getPixelFormat() == PIXELFORMAT_RGBA8888 )
+ {
+ targetType = GL_BGRA;
+ sourceType = GL_RGBA;
+ if (xim->depth == 24)
+ {
+ /* Set alpha value */
+ int count = surface->OriginalSourceWidth*surface->OriginalSourceHeight;
+ for (int j=0;j<count; j++)
+ {
+ xim->data[j*4+3]=255;
+ }
+ }
+ } else {
+ LOG_ERROR("X11CopyGLX","Pixelformat currently not supported : " << surface->getPixelFormat());
+ XDestroyImage(xim);
+ return false;
}
glTexImage2D(GL_TEXTURE_2D, 0, sourceType, surface->OriginalSourceWidth, surface->OriginalSourceHeight, 0, targetType, GL_UNSIGNED_BYTE, xim->data);
XDestroyImage(xim);