[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] libvob/vob/demo/multifil fillet3d.py
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] libvob/vob/demo/multifil fillet3d.py |
Date: |
Mon, 30 Jun 2003 05:49:27 -0400 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Branch:
Changes by: Janne V. Kujala <address@hidden> 03/06/30 05:49:27
Modified files:
vob/demo/multifil: fillet3d.py
Log message:
restore color
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/demo/multifil/fillet3d.py.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
Patches:
Index: libvob/vob/demo/multifil/fillet3d.py
diff -u libvob/vob/demo/multifil/fillet3d.py:1.14
libvob/vob/demo/multifil/fillet3d.py:1.15
--- libvob/vob/demo/multifil/fillet3d.py:1.14 Mon Jun 30 04:06:35 2003
+++ libvob/vob/demo/multifil/fillet3d.py Mon Jun 30 05:49:27 2003
@@ -35,6 +35,7 @@
"3D filleting"
def __init__(self):
self.depthTexture = GL.createTexture()
+ self.tmpTexture = GL.createTexture()
self.direct = 0
rect = 1
targ = "TEXTURE_RECTANGLE_NV"
@@ -45,8 +46,12 @@
"INT")
else:
self.depthTexture.loadNull2D("TEXTURE_RECTANGLE_NV", 0, "RGBA8",
- 1024, 768, 0, "BGRA",
- "UNSIGNED_INT_8_8_8_8")
+ 1024, 768, 0, "BGRA",
+ "UNSIGNED_INT_8_8_8_8")
+
+ self.tmpTexture.loadNull2D("TEXTURE_RECTANGLE_NV", 0, "RGB8",
+ 1024, 768, 0, "RGB",
+ "INT")
if not rect:
self.depthTexture.setTexParameter(targ,
"TEXTURE_MAX_LEVEL", 0)
@@ -134,17 +139,26 @@
vs.put(getDListNocoords("""
BindProgram VERTEX_PROGRAM_ARB 0
Disable VERTEX_PROGRAM_ARB
- BindTexture TEXTURE_RECTANGLE_NV %s
- Enable TEXTURE_RECTANGLE_NV
- """ % self.depthTexture.getTexId()))
+ """))
- if self.direct:
+ # Now, draw the edges
- # Now, draw the edges
+ if self.direct:
+ vs.put(getDListNocoords("""
+ BindTexture TEXTURE_RECTANGLE_NV %s
+ """ % self.depthTexture.getTexId()))
vs.put(GLRen.createCopyTexSubImage2D("TEXTURE_RECTANGLE_NV",
- 0, 0, 0, 1024, 768), 0)
+ 0, 0, 0, 1024, 768), 0)
elif 1:
+ # Copy the color buffer to a texture
+ vs.put(getDListNocoords("""
+ BindTexture TEXTURE_RECTANGLE_NV %s
+ """ % self.tmpTexture.getTexId()))
+ vs.put(GLRen.createCopyTexSubImage2D("TEXTURE_RECTANGLE_NV",
+ 0, 0, 0, 1024, 768), 0)
+
+ # Copy stencil&depth to color
vs.put(getDListNocoords("""
PushAttrib ENABLE_BIT
Disable ALPHA_TEST
@@ -157,10 +171,38 @@
0,
csdest,
)
+
+ # Read the depth to a texture
+ vs.put(getDListNocoords("""
+ BindTexture TEXTURE_RECTANGLE_NV %s
+ """ % self.depthTexture.getTexId()))
vs.put(GLRen.createCopyTexSubImage2D("TEXTURE_RECTANGLE_NV",
0, 0, 0, 1024, 768), 0)
+
+ # Copy the color back from the backup texture
+ vs.put(getDListNocoords("""
+ BindTexture TEXTURE_RECTANGLE_NV %s
+ Enable TEXTURE_RECTANGLE_NV
+ """ % self.tmpTexture.getTexId()))
+ vs.put(getDList("""
+ Color 1 1 1
+ Begin QUAD_STRIP
+ TexCoord 0 0
+ Vertex 0 %(h)s
+
+ TexCoord 0 %(h)s
+ Vertex 0 0
+
+ TexCoord %(w)s 0
+ Vertex %(w)s %(h)s
+
+ TexCoord %(w)s %(h)s
+ Vertex %(w)s 0
+ End
+ """ % { "w" : 1024, "h" : 768 }), 0)
+
vs.put(getDListNocoords("""
- PopAttrib
+ PopAttrib
"""))
else:
@@ -175,7 +217,9 @@
BindProgram FRAGMENT_PROGRAM_NV %s
Enable FRAGMENT_PROGRAM_NV
Enable BLEND
- """ % light3d.edgefp.getProgId()))
+ BindTexture TEXTURE_RECTANGLE_NV %s
+ """ % (light3d.edgefp.getProgId(),
+ self.depthTexture.getTexId())))
vs.put(quad(), vs.orthoCS(0, "A", -100, 0, 0, 1024,768))