[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx/demo fpfont.py
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] gzz/gfx/demo fpfont.py |
Date: |
Fri, 24 Jan 2003 09:53:03 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 03/01/24 09:53:02
Modified files:
gfx/demo : fpfont.py
Log message:
try lodbias
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/fpfont.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/fpfont.py
diff -u gzz/gfx/demo/fpfont.py:1.4 gzz/gfx/demo/fpfont.py:1.5
--- gzz/gfx/demo/fpfont.py:1.4 Fri Jan 24 08:54:47 2003
+++ gzz/gfx/demo/fpfont.py Fri Jan 24 09:53:02 2003
@@ -10,12 +10,12 @@
rect = GLSpans.getRect(pis.getCurrent())
-texid = rect.texId
-
if globals().has_key("fp"):
- fp.deleteObject()
+ for f in fp:
+ f.deleteObject()
+
-fp = GL.createProgram(
+fp = [GL.createProgram(
"""!!ARBfp1.0
# Sharpen the texture value
@@ -37,13 +37,32 @@
ADD sum, sum, n4;
MUL p, p, fragment.texcoord[5].x;
-MAD p, sum, fragment.texcoord[6].y, p;
+MAD p, sum, fragment.texcoord[5].y, p;
MOV result.color, p;
END
"""
-)
-dump(fp.getProgId())
+),
+
+GL.createProgram(
+"""!!ARBfp1.0
+
+# Sharpen the texture value
+
+TEMP p, c;
+
+MOV c, fragment.texcoord[0];
+MOV c.w, fragment.texcoord[5].w;
+
+# Read the pixel and its neighbours
+TXB p, c, texture[0], 2D;
+
+MOV result.color, p;
+END
+""")
+]
+
+dump(fp[0].getProgId())
class Scene:
def __init__(self):
@@ -52,76 +71,94 @@
SlideLin("y", 0, 30, "x coord", "Up", "Down"),
SlideLin("xg", 0, 30, "x coord", "j", "l"),
SlideLin("yg", 0, 30, "x coord", "i", ","),
+ SlideLog("ps", 800, "paper scale", "<", ">"),
+ SlideLin("ang", 0, 5, "angle", "Prior", "Next"),
+ Toggle("prognum", 0, "prog type", "t"),
+ Toggle("texfilt", 1, "texture filtering", "f"),
)
def scene(self, vs):
putnoc(vs, background((.5,.5,.5)))
- csg = vs.coords.affineCoordsys(0, 0, self.xg, self.yg,
- 1000, 0, 0, 1000)
- vs.matcher.add(cs1, "1")
+ rot = vs.rotateCS(0, "r", self.ang)
+ d = 1. / self.ps
+ csg = vs.affineCS(rot, "g", 0, self.xg, self.yg,
+ self.ps, 0, 0, self.ps)
vs.map.put(getDList("""
ActiveTexture TEXTURE0
- TexGen S TEXTURE_GEN_MODE OBJECT_LINEAR
- TexGen T TEXTURE_GEN_MODE OBJECT_LINEAR
- TexGen S OBJECT_PLANE 1 0 0 0
- TexGen T OBJECT_PLANE 0 1 0 0
+ TexGen S TEXTURE_GEN_MODE EYE_LINEAR
+ TexGen T TEXTURE_GEN_MODE EYE_LINEAR
+ TexGen S EYE_PLANE 1 0 0 0
+ TexGen T EYE_PLANE 0 1 0 0
Enable TEXTURE_GEN_S
Enable TEXTURE_GEN_T
ActiveTexture TEXTURE1
- TexGen S TEXTURE_GEN_MODE OBJECT_LINEAR
- TexGen T TEXTURE_GEN_MODE OBJECT_LINEAR
- TexGen S OBJECT_PLANE 1 0 0 .001
- TexGen T OBJECT_PLANE 0 1 0 0
+ TexGen S TEXTURE_GEN_MODE EYE_LINEAR
+ TexGen T TEXTURE_GEN_MODE EYE_LINEAR
+ TexGen S EYE_PLANE 1 0 0 %(d)s
+ TexGen T EYE_PLANE 0 1 0 0
Enable TEXTURE_GEN_S
Enable TEXTURE_GEN_T
ActiveTexture TEXTURE2
- TexGen S TEXTURE_GEN_MODE OBJECT_LINEAR
- TexGen T TEXTURE_GEN_MODE OBJECT_LINEAR
- TexGen S OBJECT_PLANE 1 0 0 0
- TexGen T OBJECT_PLANE 0 1 0 .001
+ TexGen S TEXTURE_GEN_MODE EYE_LINEAR
+ TexGen T TEXTURE_GEN_MODE EYE_LINEAR
+ TexGen S EYE_PLANE 1 0 0 0
+ TexGen T EYE_PLANE 0 1 0 %(d)s
+ #TexGen S EYE_PLANE 1 0 0 %(d)s
+ #TexGen T EYE_PLANE 0 1 0 0
Enable TEXTURE_GEN_S
Enable TEXTURE_GEN_T
ActiveTexture TEXTURE3
- TexGen S TEXTURE_GEN_MODE OBJECT_LINEAR
- TexGen T TEXTURE_GEN_MODE OBJECT_LINEAR
- TexGen S OBJECT_PLANE 1 0 0 -.001
- TexGen T OBJECT_PLANE 0 1 0 0
+ TexGen S TEXTURE_GEN_MODE EYE_LINEAR
+ TexGen T TEXTURE_GEN_MODE EYE_LINEAR
+ TexGen S EYE_PLANE 1 0 0 -%(d)s
+ TexGen T EYE_PLANE 0 1 0 0
Enable TEXTURE_GEN_S
Enable TEXTURE_GEN_T
ActiveTexture TEXTURE4
- TexGen S TEXTURE_GEN_MODE OBJECT_LINEAR
- TexGen T TEXTURE_GEN_MODE OBJECT_LINEAR
- TexGen S OBJECT_PLANE 1 0 0 0
- TexGen T OBJECT_PLANE 0 1 0 -.001
+ TexGen S TEXTURE_GEN_MODE EYE_LINEAR
+ TexGen T TEXTURE_GEN_MODE EYE_LINEAR
+ TexGen S EYE_PLANE 1 0 0 0
+ TexGen T EYE_PLANE 0 1 0 -%(d)s
+ #TexGen S EYE_PLANE 1 0 0 -%(d)s
+ #TexGen T EYE_PLANE 0 1 0 0
Enable TEXTURE_GEN_S
Enable TEXTURE_GEN_T
ActiveTexture TEXTURE0
- """), csg)
+ """ % locals()), csg)
+
+ cs1 = vs.affineCS(rot, "1", 0, self.x, self.y,
+ 300, 0, 0, 300)
- cs1 = vs.coords.affineCoordsys(0, 0, self.x, self.y,
- 1000, 0, 0, 1000)
- vs.matcher.add(cs1, "1")
+ if self.texfilt:
+ minfilt = "LINEAR_MIPMAP_LINEAR"
+ magfilt = "LINEAR"
+ else:
+ minfilt = "NEAREST_MIPMAP_NEAREST"
+ magfilt = "NEAREST"
+
+ texid = rect.texId
+ fpid = fp[self.prognum].getProgId()
vs.map.put(getDList("""
- BindProgramARB FRAGMENT_PROGRAM_ARB %s
+ BindProgramARB FRAGMENT_PROGRAM_ARB %(fpid)s
Enable FRAGMENT_PROGRAM_ARB
- BindTexture TEXTURE_2D %s
- TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
- TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR
+ BindTexture TEXTURE_2D %(texid)s
+ TexParameter TEXTURE_2D TEXTURE_MIN_FILTER %(minfilt)s
+ TexParameter TEXTURE_2D TEXTURE_MAG_FILTER %(magfilt)s
Enable TEXTURE_2D
Color 1 1 1
Begin QUAD_STRIP
- MultiTexCoord TEXTURE5 2 -1 0 0
+ MultiTexCoord TEXTURE5 4 -.75 0 -1
Vertex 0 0
Vertex 0 1
MultiTexCoord TEXTURE5 1 0 0 0
@@ -129,7 +166,9 @@
Vertex 1 1
End
Disable FRAGMENT_PROGRAM_ARB
- """ % (fp.getProgId(), texid)), cs1)
+ """ % locals()), cs1)
+
+ print self.prognum
currentScene = Scene()
- [Gzz-commits] gzz/gfx/demo fpfont.py, Tuomas J. Lukka, 2003/01/24
- [Gzz-commits] gzz/gfx/demo fpfont.py, Janne V. Kujala, 2003/01/24
- [Gzz-commits] gzz/gfx/demo fpfont.py, Tuomas J. Lukka, 2003/01/24
- [Gzz-commits] gzz/gfx/demo fpfont.py, Janne V. Kujala, 2003/01/24
- [Gzz-commits] gzz/gfx/demo fpfont.py,
Janne V. Kujala <=
- [Gzz-commits] gzz/gfx/demo fpfont.py, Janne V. Kujala, 2003/01/24
- [Gzz-commits] gzz/gfx/demo fpfont.py, Tuomas J. Lukka, 2003/01/24
- [Gzz-commits] gzz/gfx/demo fpfont.py, Tuomas J. Lukka, 2003/01/24
- [Gzz-commits] gzz/gfx/demo fpfont.py, Tuomas J. Lukka, 2003/01/24
- [Gzz-commits] gzz/gfx/demo fpfont.py, Janne V. Kujala, 2003/01/24
- [Gzz-commits] gzz/gfx/demo fpfont.py, Tuomas J. Lukka, 2003/01/25