[Top][All Lists]
[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: |
Tue, 05 Nov 2002 08:23:41 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 02/11/05 08:23:40
Modified files:
gfx/demo : irregu3.py
Log message:
Add untested "flood fill" fragment program profile
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/irregu3.py.diff?tr1=1.44&tr2=1.45&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/irregu3.py
diff -u gzz/gfx/demo/irregu3.py:1.44 gzz/gfx/demo/irregu3.py:1.45
--- gzz/gfx/demo/irregu3.py:1.44 Sat Nov 2 09:51:36 2002
+++ gzz/gfx/demo/irregu3.py Tue Nov 5 08:23:40 2002
@@ -21,6 +21,7 @@
if (GL.hasExtension("GL_NV_fragment_program")):
profiles.append("NV_PROG")
+ profiles.append("NV_PROG2")
if (GL.hasExtension("GL_NV_texture_shader")):
profiles.append("NV_SHAD")
@@ -76,7 +77,7 @@
print "Using profile:", profile
- if profile == "NV_PROG":
+ if profile == "NV_PROG" or profile == "NV_PROG2":
print "Using 2-vector HILO displacement texture with
GL_NV_fragment_program"
using_fragprog = 1
@@ -148,6 +149,38 @@
END
"""
+ if profile == "NV_PROG2":
+ # "Flood fill" implementation; NOT TESTED
+
+ code = """
+ # f[TEX0].xyw texture coordinates
+ # f[TEX2].xy texture HI and LO component weights
+ # f[TEX2].w displacement (added to the weighted texture value)
+
+ # Read texture
+ TXP R0, f[TEX0], TEX0, 2D;
+
+ # Weight, add displacement, and use as output color
+ DP4 R0, R0, f[TEX2];
+
+ # R0 <- (R0 >= 1.0)
+ SGE R0, R0, 1.0;
+
+ # R1 <- 2 grad(R0) . grad(R0)
+ DDX R1.x, R0;
+ DDY R1.y, R0;
+ DP4 R1, R1.xyxy, R1.xyxy;
+
+ # R2 <- 2 grad(R1) . grad(R1)
+ DDX R2.x, R1;
+ DDY R2.x, R1;
+ DP4 R2, R2.xyxy, R2.xyxy;
+
+ # Use R1 + R2 > 0 as the output color
+ ADD R1, R1, R2;
+ SGE o[COLR], R1, 0.0;
+ """
+
prog_outer = GL.createProgram(code)
@@ -435,7 +468,7 @@
init()
elif "F1" <= k <= "F9":
global profile
- profile = profiles[int(k[1]) - 1]
+ profile = profiles[int(k[1:]) - 1]
init()
elif k == "m":
global matrices
@@ -876,8 +909,8 @@
if k == "Next":
self.angle += pi/180; print "angle",round(self.angle / pi * 180)
reinit = 1
- if k == "Home": self.angle2 -= pi/180; self.angle += pi/180
- if k == "End": self.angle2 += pi/180; self.angle -= pi/180
+ if k == "Home": self.angle2 -= pi/180; self.angle += pi/180; reinit = 1
+ if k == "End": self.angle2 += pi/180; self.angle -= pi/180; reinit = 1
if k == "i": self.use_stencil = not self.use_stencil
- [Gzz-commits] gzz/gfx/demo irregu3.py, Janne V. Kujala, 2002/11/01
- [Gzz-commits] gzz/gfx/demo irregu3.py, Janne V. Kujala, 2002/11/01
- [Gzz-commits] gzz/gfx/demo irregu3.py, Janne V. Kujala, 2002/11/01
- [Gzz-commits] gzz/gfx/demo irregu3.py, Janne V. Kujala, 2002/11/02
- [Gzz-commits] gzz/gfx/demo irregu3.py, Janne V. Kujala, 2002/11/05
- [Gzz-commits] gzz/gfx/demo irregu3.py,
Janne V. Kujala <=
- [Gzz-commits] gzz/gfx/demo irregu3.py, Tuomas J. Lukka, 2002/11/08