From 1c3dae8c758e1fe1c483ffa55529687013217794 Mon Sep 17 00:00:00 2001 From: Michael Schuldt Date: Tue, 12 Jul 2011 14:11:11 +0200 Subject: Fixes issue with native X windows - correctly displayed if the surface has the RGBA pixformat --- .../Graphic/src/TextureBinders/X11CopyGLX.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'LayerManagerPlugins') 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;jdata[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); -- cgit v1.2.1