/[gzz]/gzz/gfx/demo/opengl/fragprog.py
ViewVC logotype

Diff of /gzz/gfx/demo/opengl/fragprog.py

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

revision 1.1 by jvk, Fri Jan 24 11:20:16 2003 UTC revision 1.2 by jvk, Fri Jan 24 12:01:22 2003 UTC
# Line 1  Line 1 
1    if globals().has_key("fp"):
2            fp.deleteObject()
3    
4    fp = GL.createProgram("""!!ARBfp1.0
 class Scene:  
     def __init__(self):  
         self.fp = GL.createProgram("""!!ARBfp1.0  
5          # No texture instructions, but always 1 indirection          # No texture instructions, but always 1 indirection
6          MOV result.color, fragment.color;          #MOV result.color, fragment.color;
7    
8            PARAM col = { 50, .5, 1, 1 };
9            TEMP x;
10            MUL x.x, fragment.position.x, col.x;
11            MUL x.y, fragment.position.y, col.x;
12            SIN x.x, x.x;
13            COS x.y, x.y;
14    
15            MOV x.zw, col;
16            MOV result.color, x;
17          END          END
18          """)          """)
19    
20    class Scene:
21        def __init__(self):
22            self.x = 512
23            self.y = 384
24    
25      def scene(self, vs):      def scene(self, vs):
26          putnoc(vs, background((.5,.5,.5)))          putnoc(vs, background((.5,.5,.5)))
27    
28          cs1 = vs.coords.affineCoordsys(0, 0, 512, 384,          cs1 = vs.coords.affineCoordsys(0, 0, self.x, self.y,
29              256, 0, 0, 256)              256, 0, 0, 256)
30          vs.matcher.add(cs1, "1")          vs.matcher.add(cs1, "1")
31    
32          vs.map.put(getDList("""          vs.map.put(getDList("""
33          BindProgramNV FRAGMENT_PROGRAM_ARB %s          BindProgramARB FRAGMENT_PROGRAM_ARB %s
34          Enable FRAGMENT_PROGRAM_ARB          Enable FRAGMENT_PROGRAM_ARB
35          Color 1 1 1          Color 1 1 1
36          Begin QUAD_STRIP          Begin QUAD_STRIP
# Line 26  class Scene: Line 40  class Scene:
40          Vertex 1 1          Vertex 1 1
41          End          End
42          Disable FRAGMENT_PROGRAM_ARB          Disable FRAGMENT_PROGRAM_ARB
43          """ % self.fp.getProgId()), cs1)          """ % fp.getProgId()), cs1)
44    
45        def key(self,k):
46            pass
47    
48  currentScene = Scene()  currentScene = Scene()

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