From 0b6e47ea35824f2b37505f50d361ea2d810d1a84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sat, 5 Feb 2011 11:56:48 +0100 Subject: [PATCH] Readd the hack for Xgl in findTarget. Apparently glXQueryDrawable does not work in NVIDIA blob for binding a texture from an icon. This fixes an abort, but the root cause should be found and fixed properly. --- scene_opengl_glx.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scene_opengl_glx.cpp b/scene_opengl_glx.cpp index fc7a52b1e7..4e89664f56 100644 --- a/scene_opengl_glx.cpp +++ b/scene_opengl_glx.cpp @@ -653,6 +653,17 @@ void SceneOpenGL::Texture::findTarget() unsigned int new_target = 0; if (glXQueryDrawable && glxpixmap != None) glXQueryDrawable(display(), glxpixmap, GLX_TEXTURE_TARGET_EXT, &new_target); + // HACK: this used to be a hack for Xgl. + // without this hack the NVIDIA blob aborts when trying to bind a texture from + // a pixmap icon + if (new_target == 0) { + if (NPOTTextureSupported() || + (isPowerOfTwo(mSize.width()) && isPowerOfTwo(mSize.height()))) { + new_target = GLX_TEXTURE_2D_EXT; + } else { + new_target = GLX_TEXTURE_RECTANGLE_EXT; + } + } switch(new_target) { case GLX_TEXTURE_2D_EXT: mTarget = GL_TEXTURE_2D;