gzz-commits
[Top][All Lists]
Advanced

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

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


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz/gfx/demo text.py
Date: Sat, 25 Jan 2003 06:02:33 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        03/01/25 06:02:33

Modified files:
        gfx/demo       : text.py 

Log message:
        Work with jvk, on clearing up text rendering by filtering cleverly.

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

Patches:
Index: gzz/gfx/demo/text.py
diff -u gzz/gfx/demo/text.py:1.3 gzz/gfx/demo/text.py:1.4
--- gzz/gfx/demo/text.py:1.3    Tue Oct  8 03:30:12 2002
+++ gzz/gfx/demo/text.py        Sat Jan 25 06:02:33 2003
@@ -1,5 +1,7 @@
 from gfx.libutil import nvcode
 from gzz.vob import *
+from gfx.util.demokeys import *
+import gfx.util.text
 
 fonts = [ GL.createFont("gfx/fonts/a010013l.pfb", size)
     for size in (8, 16, 24, 32, 64) ]
@@ -9,42 +11,51 @@
 for f in fonts:
     print f.getHeight(), f.getYOffs()
 
-A = [GLRen.createHorizText2(f, "ABCgabcg", 1, 1, 1, 0) for f in fonts]
+A = [GLRen.createHorizText(f, "ABCgabcg", 0, 0, 0, 1) for f in fonts]
 B = TextVob(textstyle, "ABCgabcg", 0) 
 C = TextVob(textstyle, "ABCgabcg", 1) 
 
 cq = coloredQuad((1,1,1))
 
+vp = gfx.util.text.vp
+
 class TextScene:
     def __init__(self):
-       self.fontind = len(A)-1
+       self.fonts = fonts
        self.offset = [(0,0),(1.5,1.5),(0,1.5),(1.5,0)]
-       self.regcomb = 0
+       self.regcomb = [getDListNocoords(nvcode.parseCombiner(x)) for x in [
+       ] ]
        self.textvobs = [B, C]
+
+       self.key = KeyPresses(self, 
+           ListIndex("rcind", "regcomb", 0, "regcomb type", "C", "c"),
+           ListIndex("offsind", "offset", 0, "Move text slightly", None, " "),
+           ListIndex("fontind", "fonts", 4, "Base font size", "F", "f"),
+       )
+           
     
-    def key(self, key):
-       if key == "b":
-           rotatelist(self.textvobs)
-           AbstractUpdateManager.setNoAnimation()
-           AbstractUpdateManager.chg()
-       if key == "c":
-           self.regcomb = not self.regcomb
-           AbstractUpdateManager.setNoAnimation()
-           AbstractUpdateManager.chg()
-       if key == "+":
-           self.fontind += 1
-           AbstractUpdateManager.setNoAnimation()
-           AbstractUpdateManager.chg()
-       if key == "-":
-           self.fontind -= 1
-           AbstractUpdateManager.setNoAnimation()
-           AbstractUpdateManager.chg()
-       if key == " ":
-           rotatelist(self.offset)
-           AbstractUpdateManager.chg()
-       pass
+    # def key(self, key):
+#      if key == "b":
+#          rotatelist(self.textvobs)
+#          AbstractUpdateManager.setNoAnimation()
+#          AbstractUpdateManager.chg()
+#      if key == "c":
+#          self.regcomb = not self.regcomb
+#          AbstractUpdateManager.setNoAnimation()
+#          AbstractUpdateManager.chg()
+#      if key == "+":
+#          self.fontind += 1
+#          AbstractUpdateManager.setNoAnimation()
+#          AbstractUpdateManager.chg()
+#      if key == "-":
+#          self.fontind -= 1
+#          AbstractUpdateManager.setNoAnimation()
+#          AbstractUpdateManager.chg()
+#      if key == " ":
+#          rotatelist(self.offset)
+#          AbstractUpdateManager.chg()
+ #     pass
     def scene(self, vs):
-       self.fontind %= len(A)
        vs.map.put(background((0.3,0.5,0.6)))
 
        vs.map.put(getDListNocoords("""
@@ -52,25 +63,20 @@
            Enable BLEND
            Disable ALPHA_TEST
            PushAttrib ENABLE_BIT TEXTURE_BIT
-           Disable TEXTURE_2D
-       """))
 
-       if self.regcomb:
-           vs.map.put(getDListNocoords(nvcode.combinercode("""
-               Enable REGISTER_COMBINERS_NV
-               CombinerParameterNV NUM_GENERAL_COMBINERS_NV 1
-               CombinerParameterNV CONSTANT_COLOR0_NV 0 0 0 0.4
-               CI0 ALPHA A TEXTURE0 UNSIGNED_IDENTITY_NV ALPHA
-               CI0 ALPHA B CONSTANT_COLOR0_NV UNSIGNED_IDENTITY_NV ALPHA
-               CO0 ALPHA SPARE0_NV DISCARD_NV DISCARD_NV SCALE_BY_FOUR_NV  
NONE FALSE FALSE FALSE
-
-               FCI A ZERO UNSIGNED_IDENTITY_NV RGB
-               FCI B ZERO UNSIGNED_IDENTITY_NV RGB
-               FCI C ZERO UNSIGNED_IDENTITY_NV RGB
-               FCI D ZERO UNSIGNED_IDENTITY_NV RGB
+           BindProgram VERTEX_PROGRAM_ARB %s
+           Enable VERTEX_PROGRAM_ARB
+
+           ActiveTexture TEXTURE1
+           Enable TEXTURE_2D
+           TexEnv TEXTURE_FILTER_CONTROL TEXTURE_LOD_BIAS .5
+
+           ActiveTexture TEXTURE0
+
+           Enable TEXTURE_2D
+       """ % vp.getProgId()))
 
-               FCI G SPARE0_NV UNSIGNED_IDENTITY_NV ALPHA
-           """)))
+       vs.map.put(self.regcomb[self.rcind])
 
        y = 20
        sizes = (5, 6, 7, 8, 9, 10, 12, 15, 16, 20, 24, 32, 64, 100, 200)
@@ -78,7 +84,7 @@
        for s in sizes:
            y += s
            for i in (self.fontind,): # range(0,len(A)):
-               vs.put(A[i], str((s,i)), 0, 150 + self.offset[0][0], y + 
self.offset[0][1], s, s)
+               vs.put(A[i], str((s,i)), 0, 150 + self.offset[self.offsind][0], 
y + self.offset[self.offsind][1], s, s)
 
        vs.map.put(getDListNocoords("""
            PopAttrib 
@@ -88,7 +94,7 @@
        y = 20
        for s in sizes:
            y += s
-           cs = vs.coords.coordsys(0, 0, 500 + self.offset[0][0], y + 
self.offset[0][1], s, s)
+           cs = vs.coords.ortho(0, 0, 500 + self.offset[0][0], y + 
self.offset[0][1], s, s)
            vs.matcher.add(cs, "B"+str(s))
            vs.map.put(getDListNocoords("""
                Disable TEXTURE_2D




reply via email to

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