gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz/gfx/demo irregu3.py


From: Janne V. Kujala
Subject: [Gzz-commits] gzz/gfx/demo irregu3.py
Date: Fri, 25 Oct 2002 05:17:53 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Janne V. Kujala <address@hidden>        02/10/25 05:17:53

Modified files:
        gfx/demo       : irregu3.py 

Log message:
        Add "m" and "t" keys for changing matrices and textures

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/irregu3.py.diff?tr1=1.19&tr2=1.20&r1=text&r2=text

Patches:
Index: gzz/gfx/demo/irregu3.py
diff -u gzz/gfx/demo/irregu3.py:1.19 gzz/gfx/demo/irregu3.py:1.20
--- gzz/gfx/demo/irregu3.py:1.19        Fri Oct 25 04:48:12 2002
+++ gzz/gfx/demo/irregu3.py     Fri Oct 25 05:17:53 2002
@@ -6,6 +6,11 @@
 size = 256
 lodbias = 0
 
+use_texture = 0
+
+matrices = [ "1 0 0 0  0 1 0 0  0 0 1 0  0 0 0 1",
+             "4 0 0 0.005  0 1 0 0  0 0 1 0  0 0 0 1" ]
+
 profiles = []
 
 if (GL.hasExtension("GL_NV_register_combiners") and
@@ -136,6 +141,12 @@
     if "F1" <= k <= "F4":
         global profiles
         init(profiles[int(k[1]) - 1])
+    elif k == "m":
+        global matrices
+        matrices = matrices[1:] + matrices[:1]
+    elif k == "t":
+        global use_texture
+        use_texture = not use_texture
         
 
 
@@ -196,7 +207,7 @@
     dotvec = js(vec)
 
     code = """
-    PushAttrib ENABLE_BIT
+    PushAttrib ENABLE_BIT TEXTURE_BIT
 
     BindTexture TEXTURE_2D %(texid)s
     TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
@@ -299,17 +310,33 @@
         vs.matcher.add(cs4, "4")
         vs.map.put(GLRen.createTextureMatrix(), cs4)
 
+        texid = getCachedTexture([4, 4, 0, 3, "RGB", "RGB", "geometric",
+                                  ["type", "1", "scale", ".25", "bias", 
".75"]]).getTexId()
+
+        if use_texture:
+            tex2d = "Enable"
+        else:
+            tex2d = "Disable"
+        
         paint = """
             PushAttrib ENABLE_BIT
             Enable STENCIL_TEST
             Disable ALPHA_TEST
             StencilFunc EQUAL 0 255
             StencilOp ZERO ZERO ZERO
-            Disable TEXTURE_2D
+            %(tex2d)s TEXTURE_2D
+            BindTexture TEXTURE_2D %(texid)s
+            TexParameter TEXTURE_2D TEXTURE_MIN_FILTER NEAREST
+            TexParameter TEXTURE_2D TEXTURE_MAG_FILTER NEAREST
+            #TexEnv TEXTURE_ENV TEXTURE_ENV_MODE MODULATE
             Begin QUAD_STRIP
+            TexCoord 0 0
             Vertex %(x0)s %(y0)s
+            TexCoord 2.25 0
             Vertex %(x1)s %(y0)s
+            TexCoord 0 2.25
             Vertex %(x0)s %(y1)s
+            TexCoord 2.25 2.25
             Vertex %(x1)s %(y1)s
             End 
             PopAttrib
@@ -318,8 +345,8 @@
         vs.map.put(getDListNocoords("""
             PushMatrix
 
-            MultMatrix  1 0 0 0  0 1 0 0  0 0 1 0  0 0 0 1
-        """))
+            MultMatrix  %s
+        """ % matrices[0]))
 
         vs.map.put(getDList(getIrregu(0,x0,-1,x1,-1,1, texscale, self.angle) +
                             getIrregu(0,+1,y0,+1,y1,1, texscale, self.angle) +




reply via email to

[Prev in Thread] Current Thread [Next in Thread]