[beryl-commits] compiz mirror: Changes to 'master' (a8f4adfd58ab8c75ec20b8b8f8161196dcc0c544)

compiz at server.beryl-project.org compiz at server.beryl-project.org
Mon Jun 11 20:23:07 CEST 2007


New commits:
commit a8f4adfd58ab8c75ec20b8b8f8161196dcc0c544
Author: Dennis Kasprzyk <onestone at beryl-project.org>
Date:   Mon Jun 11 20:18:54 2007 +0200

    Use texture matrix in skydome (Fixes GL_TEXTURE_RECTANGLE skydome images).

commit 73d7bd920e5b43b52211e73f459669229b1c5314
Author: Dennis Kasprzyk <onestone at beryl-project.org>
Date:   Mon Jun 11 20:01:56 2007 +0200

    Initialize skydome texture matrix.


 include/cube.h |    7 ++++---
 plugins/cube.c |   46 ++++++++++++++++++++++++++++++++--------------
 2 files changed, 36 insertions(+), 17 deletions(-)


Modified: compiz/include/cube.h
===================================================================
--- compiz/include/cube.h
+++ compiz/include/cube.h
@@ -25,7 +25,7 @@
 
 #include <compiz.h>
 
-#define CUBE_ABIVERSION 20070523
+#define CUBE_ABIVERSION 20070611
 
 #define CUBE_DISPLAY_OPTION_ABI    0
 #define CUBE_DISPLAY_OPTION_INDEX  1
@@ -105,8 +105,9 @@ typedef struct _CubeScreen {
 
     GLuint skyListId;
 
-    int		pw, ph;
-    CompTexture texture, sky;
+    int		 pw, ph;
+    unsigned int skyW, skyH;
+    CompTexture  texture, sky;
 
     int	imgCurFile;
 

Modified: compiz/plugins/cube.c
===================================================================
--- compiz/plugins/cube.c
+++ compiz/plugins/cube.c
@@ -304,8 +304,8 @@ cubeUpdateSkyDomeTexture (CompScreen *screen)
 	!readImageToTexture (screen,
 			     &cs->sky,
 			     cs->opt[CUBE_SCREEN_OPTION_SKYDOME_IMG].value.s,
-			     NULL,
-			     NULL))
+			     &cs->skyW,
+			     &cs->skyH))
     {
 	GLfloat aaafTextureData[128][128][3];
 	GLfloat fRStart = (GLfloat)
@@ -347,6 +347,16 @@ cubeUpdateSkyDomeTexture (CompScreen *screen)
 	cs->sky.filter = GL_LINEAR;
 	cs->sky.wrap   = GL_CLAMP_TO_EDGE;
 
+	cs->sky.matrix.xx = 1.0 / 128.0;
+	cs->sky.matrix.yy = -1.0 / 128.0;
+	cs->sky.matrix.xy = 0;
+	cs->sky.matrix.yx = 0;
+	cs->sky.matrix.x0 = 0;
+	cs->sky.matrix.y0 = 1.0;
+
+	cs->skyW = 128;
+	cs->skyH = 128;
+
 	glGenTextures (1, &cs->sky.name);
 	glBindTexture (cs->sky.target, cs->sky.name);
 
@@ -461,13 +471,13 @@ cubeUpdateSkyDomeList (CompScreen *s,
     }
 
     afTexCoordX[0] = 1.0f;
-    afTexCoordY[0] = fStepY;
+    afTexCoordY[0] = 1.0f - fStepY;
     afTexCoordX[1] = 1.0f - fStepX;
-    afTexCoordY[1] = fStepY;
+    afTexCoordY[1] = 1.0f - fStepY;
     afTexCoordX[2] = 1.0f - fStepX;
-    afTexCoordY[2] = 0.0f;
+    afTexCoordY[2] = 1.0f;
     afTexCoordX[3] = 1.0f;
-    afTexCoordY[3] = 0.0f;
+    afTexCoordY[3] = 1.0f;
 
     if (!cs->skyListId)
 	cs->skyListId = glGenLists (1);
@@ -493,7 +503,9 @@ cubeUpdateSkyDomeList (CompScreen *s,
 	    x = cost1[j];
 	    y = sint1[j];
 
-	    glTexCoord2f (afTexCoordX[3], afTexCoordY[3]);
+	    glTexCoord2f (
+		COMP_TEX_COORD_X( &cs->sky.matrix, afTexCoordX[3] * cs->skyW),
+		COMP_TEX_COORD_Y( &cs->sky.matrix, afTexCoordY[3] * cs->skyH));
 	    glVertex3f (x * r * fRadius, y * r * fRadius, z * fRadius);
 
 	    /* top-right */
@@ -502,7 +514,9 @@ cubeUpdateSkyDomeList (CompScreen *s,
 	    x = cost1[j];
 	    y = sint1[j];
 
-	    glTexCoord2f (afTexCoordX[0], afTexCoordY[0]);
+	    glTexCoord2f (
+		COMP_TEX_COORD_X( &cs->sky.matrix, afTexCoordX[0] * cs->skyW),
+		COMP_TEX_COORD_Y( &cs->sky.matrix, afTexCoordY[0] * cs->skyH));
 	    glVertex3f (x * r * fRadius, y * r * fRadius, z * fRadius);
 
 	    /* top-left */
@@ -511,7 +525,9 @@ cubeUpdateSkyDomeList (CompScreen *s,
 	    x = cost1[j + 1];
 	    y = sint1[j + 1];
 
-	    glTexCoord2f (afTexCoordX[1], afTexCoordY[1]);
+	    glTexCoord2f (
+		COMP_TEX_COORD_X( &cs->sky.matrix, afTexCoordX[1] * cs->skyW),
+		COMP_TEX_COORD_Y( &cs->sky.matrix, afTexCoordY[1] * cs->skyH));
 	    glVertex3f (x * r * fRadius, y * r * fRadius, z * fRadius);
 
 	    /* bottom-left */
@@ -520,7 +536,9 @@ cubeUpdateSkyDomeList (CompScreen *s,
 	    x = cost1[j + 1];
 	    y = sint1[j + 1];
 
-	    glTexCoord2f (afTexCoordX[2], afTexCoordY[2]);
+	    glTexCoord2f (
+		COMP_TEX_COORD_X( &cs->sky.matrix, afTexCoordX[2] * cs->skyW),
+		COMP_TEX_COORD_Y( &cs->sky.matrix, afTexCoordY[2] * cs->skyH));
 	    glVertex3f (x * r * fRadius, y * r * fRadius, z * fRadius);
 
 	    afTexCoordX[0] -= fStepX;
@@ -529,10 +547,10 @@ cubeUpdateSkyDomeList (CompScreen *s,
 	    afTexCoordX[3] -= fStepX;
 	}
 
-	afTexCoordY[0] += fStepY;
-	afTexCoordY[1] += fStepY;
-	afTexCoordY[2] += fStepY;
-	afTexCoordY[3] += fStepY;
+	afTexCoordY[0] -= fStepY;
+	afTexCoordY[1] -= fStepY;
+	afTexCoordY[2] -= fStepY;
+	afTexCoordY[3] -= fStepY;
     }
 
     glEnd ();



More information about the commits mailing list