[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx/demo/opengl fragprog.py
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] gzz/gfx/demo/opengl fragprog.py |
Date: |
Fri, 24 Jan 2003 08:12:52 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 03/01/24 08:12:52
Modified files:
gfx/demo/opengl: fragprog.py
Log message:
more fragprog
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/opengl/fragprog.py.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/opengl/fragprog.py
diff -u gzz/gfx/demo/opengl/fragprog.py:1.3 gzz/gfx/demo/opengl/fragprog.py:1.4
--- gzz/gfx/demo/opengl/fragprog.py:1.3 Fri Jan 24 07:08:48 2003
+++ gzz/gfx/demo/opengl/fragprog.py Fri Jan 24 08:12:52 2003
@@ -1,51 +1,75 @@
from gfx.util.demokeys import *
from gfx.util.misc import *
+from gfx.libpaper.texcache import getCachedTexture
+
+from gfx.util.fparb import dump
if globals().has_key("fp"):
fp.deleteObject()
+tex = getCachedTexture([256, 256, 0, 3, "RGB", "RGB", "noise",
+ ["scale", "1", "bias", ".5"]])
+
fp = GL.createProgram("""!!ARBfp1.0
# No texture instructions, but always 1 indirection
#MOV result.color, fragment.color;
- PARAM col = { 50, .5, 1, 1 };
+ PARAM col = { .1, .5, 1, 1 };
TEMP x;
+ TEMP y;
MUL x.x, fragment.position.x, col.x;
MUL x.y, fragment.position.y, col.x;
- SIN x.x, x.x;
- COS x.y, x.y;
+ SIN y.x, x.x;
+ #SIN x.x, x.x;
+ #SIN x.x, x.x;
+ #COS x.y, x.y;
+ COS y.y, x.y;
MOV x.zw, col;
+
+ TEX x, fragment.texcoord[0], texture[0], 2D;
+ ADD x, x, y;
+ MUL x, x, col.y;
+ ADD x, x, fragment.texcoord[0].yxzw;
+ TEX x, x, texture[0], 2D;
+
MOV result.color, x;
END
""")
+dump(fp.getProgId())
class Scene:
def __init__(self):
self.key = KeyPresses(self,
- SlideLin("x", 512, 30, "x coord", "Left", "Right"),
- SlideLin("y", 384, 30, "x coord", "Up", "Down"),
+ SlideLin("x", 0, 30, "x coord", "Left", "Right"),
+ SlideLin("y", 0, 30, "x coord", "Up", "Down"),
)
def scene(self, vs):
putnoc(vs, background((.5,.5,.5)))
cs1 = vs.coords.affineCoordsys(0, 0, self.x, self.y,
- 256, 0, 0, 256)
+ 1024, 0, 0, 768)
vs.matcher.add(cs1, "1")
vs.map.put(getDList("""
BindProgramARB FRAGMENT_PROGRAM_ARB %s
- Enable FRAGMENT_PROGRAM_ARB
+ Enable FRAGMENT_PROGRAM_ARB
+ BindTexture TEXTURE_2D %s
+ Enable TEXTURE_2D
Color 1 1 1
Begin QUAD_STRIP
- Vertex -1 -1
- Vertex -1 1
- Vertex 1 -1
+ TexCoord 0 0
+ Vertex 0 0
+ TexCoord 0 4
+ Vertex 0 1
+ TexCoord 4 0
+ Vertex 1 0
+ TexCoord 4 4
Vertex 1 1
End
Disable FRAGMENT_PROGRAM_ARB
- """ % fp.getProgId()), cs1)
+ """ % (fp.getProgId(), tex.getTexId())), cs1)
currentScene = Scene()