/[gzz]/gzz/gfx/demo/fpfont.py
ViewVC logotype

Diff of /gzz/gfx/demo/fpfont.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by tjl, Fri Jan 24 13:21:17 2003 UTC revision 1.2 by jvk, Fri Jan 24 13:46:20 2003 UTC
# Line 1  Line 1 
1    from gfx.util.demokeys import *
2    from gfx.util.misc import *
3    from gfx.libpaper.texcache import getCachedTexture
4    import gzz.media.impl
5    from gfx.util.fparb import dump
6    
7    
8    pis = gzz.media.impl.PageImageScroll(None, gzz.mediaserver.Mediaserver.Id(
9        "01E1682758ABF63E7833692653A5DE46EA53A6F8AA"))
10    
11    rect = GLSpans.getRect(pis.getCurrent())
12    
13    texid = rect.texId
14    
15    if globals().has_key("fp"):
16            fp.deleteObject()
17    
18    fp = GL.createProgram(
19  """!!ARBfp1.0  """!!ARBfp1.0
20    
21  # Sharpen the texture value  # Sharpen the texture value
# Line 26  MAD p, sum, fragment.texcoord[6].y, p; Line 42  MAD p, sum, fragment.texcoord[6].y, p;
42  MOV result.color, p;  MOV result.color, p;
43  END  END
44  """  """
45    )
46    dump(fp.getProgId())
47    
48    class Scene:
49        def __init__(self):
50            self.key = KeyPresses(self,
51                SlideLin("x", 0, 30, "x coord", "Left", "Right"),
52                SlideLin("y", 0, 30, "x coord", "Up", "Down"),
53            )
54    
55        def scene(self, vs):
56            putnoc(vs, background((.5,.5,.5)))
57    
58            cs1 = vs.coords.affineCoordsys(0, 0, self.x, self.y,
59                1000, 0, 0, 1000)
60            vs.matcher.add(cs1, "1")
61    
62            vs.map.put(getDList("""
63            BindProgramARB FRAGMENT_PROGRAM_ARB %s
64            #Enable FRAGMENT_PROGRAM_ARB
65    
66            ActiveTexture TEXTURE0
67            TexGen S TEXTURE_GEN_MODE OBJECT_LINEAR
68            TexGen T TEXTURE_GEN_MODE OBJECT_LINEAR
69            TexGen S OBJECT_PLANE 1 0 0 0
70            TexGen T OBJECT_PLANE 0 1 0 0
71            Enable TEXTURE_GEN_S
72            Enable TEXTURE_GEN_T
73    
74            ActiveTexture TEXTURE1
75            TexGen S TEXTURE_GEN_MODE OBJECT_LINEAR
76            TexGen T TEXTURE_GEN_MODE OBJECT_LINEAR
77            TexGen S OBJECT_PLANE 1 0 0 .001
78            TexGen T OBJECT_PLANE 0 1 0 0
79            Enable TEXTURE_GEN_S
80            Enable TEXTURE_GEN_T
81    
82            ActiveTexture TEXTURE2
83            TexGen S TEXTURE_GEN_MODE OBJECT_LINEAR
84            TexGen T TEXTURE_GEN_MODE OBJECT_LINEAR
85            TexGen S OBJECT_PLANE 1 0 0 0
86            TexGen T OBJECT_PLANE 0 1 0 .001
87            Enable TEXTURE_GEN_S
88            Enable TEXTURE_GEN_T
89    
90            ActiveTexture TEXTURE3
91            TexGen S TEXTURE_GEN_MODE OBJECT_LINEAR
92            TexGen T TEXTURE_GEN_MODE OBJECT_LINEAR
93            TexGen S OBJECT_PLANE 1 0 0 -.001
94            TexGen T OBJECT_PLANE 0 1 0 0
95            Enable TEXTURE_GEN_S
96            Enable TEXTURE_GEN_T
97    
98            ActiveTexture TEXTURE4
99            TexGen S TEXTURE_GEN_MODE OBJECT_LINEAR
100            TexGen T TEXTURE_GEN_MODE OBJECT_LINEAR
101            TexGen S OBJECT_PLANE 1 0 0 0
102            TexGen T OBJECT_PLANE 0 1 0 -.001
103            Enable TEXTURE_GEN_S
104            Enable TEXTURE_GEN_T
105    
106            ActiveTexture TEXTURE0
107            
108            BindTexture TEXTURE_2D %s
109            Enable TEXTURE_2D
110            Color 1 1 1
111            Begin QUAD_STRIP
112            Vertex 0 0
113            Vertex 0 1
114            Vertex 1 0
115            Vertex 1 1
116            End
117            Disable FRAGMENT_PROGRAM_ARB
118            """ % (fp.getProgId(), texid)), cs1)
119    
120    
121    currentScene = Scene()
122    
123    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26