>From 2b47b88d1b26323a2ef3244c6ba2ee7d8a441e56 Mon Sep 17 00:00:00 2001
From: Frederic Plourde <[email protected]>
Date: Tue, 20 Sep 2011 16:14:13 -0400
Subject: [PATCH] Set GL_TEXTURE0 as the main openGL plugin texture unit

This patch assumes our main fragment shaders use texture unit 0 for
sampling texture0. This lets plugins define other textures on other
texture units without breaking texturing.

Eventually, we'll have to come up with some kind of texture manager
which would allow plugins to register for available texture units
before they are allowed to use activate them.
---
 plugins/opengl/src/paint.cpp |    1 +
 plugins/opengl/src/shaders.h |    6 ++++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/plugins/opengl/src/paint.cpp b/plugins/opengl/src/paint.cpp
index 01e433e..7f4e7a7 100644
--- a/plugins/opengl/src/paint.cpp
+++ b/plugins/opengl/src/paint.cpp
@@ -1023,6 +1023,7 @@ GLWindow::glDrawTexture (GLTexture                
*texture,
     priv->vertexBuffer->setProgram (program);
     priv->shaders.clear ();
 
+    glActiveTexture(GL_TEXTURE0);
     texture->enable (filter);
 
     #ifdef USE_GLES
diff --git a/plugins/opengl/src/shaders.h b/plugins/opengl/src/shaders.h
index 2bd08b5..0b221e0 100644
--- a/plugins/opengl/src/shaders.h
+++ b/plugins/opengl/src/shaders.h
@@ -76,6 +76,12 @@ void main ()
{                                                  \n\
 // - y is brightness
 // - z is saturation
 
+//texture0 is the main texture bound to texture unit 0 from GLWindow::
+//glDrawTexture (). texture1, texture2 and texture3 are meant for
+//multitexturing and should not be used by plugins.
+
+//TODO: Add multitexturing support.
+
 static const char mainFragmentShader[] =
"                                   \n\
 #ifdef
GL_ES                                                                 \n\
 precision mediump
float;                                                     \n\
-- 
1.7.4.1

_______________________________________________
dev mailing list
[email protected]
http://lists.compiz.org/mailman/listinfo/dev

Reply via email to