[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx/libpaper papermill.py
From: |
Matti Katila |
Subject: |
[Gzz-commits] gzz/gfx/libpaper papermill.py |
Date: |
Wed, 01 Jan 2003 08:55:08 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Matti Katila <address@hidden> 03/01/01 08:55:07
Modified files:
gfx/libpaper : papermill.py
Log message:
Dirty fix for OpenGL 1.1 issue. At least no white papers.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/papermill.py.diff?tr1=1.65&tr2=1.66&r1=text&r2=text
Patches:
Index: gzz/gfx/libpaper/papermill.py
diff -u gzz/gfx/libpaper/papermill.py:1.65 gzz/gfx/libpaper/papermill.py:1.66
--- gzz/gfx/libpaper/papermill.py:1.65 Wed Dec 11 01:24:12 2002
+++ gzz/gfx/libpaper/papermill.py Wed Jan 1 08:55:07 2003
@@ -16,8 +16,7 @@
from java.lang import Math
from gzz.gfx.gl import PaperOptions
-tmp = PaperOptions.instance();
-use_opengl_1_1 = tmp.use_opengl_1_1
+paperopt = PaperOptions.instance();
dbg=1
# Discriminate between different renderers.
@@ -34,7 +33,7 @@
#
# Check which texture operations to use.
-if not use_opengl_1_1 and GL.hasExtension("GL_NV_texture_shader3"):
+if not paperopt.use_opengl_1_1 and GL.hasExtension("GL_NV_texture_shader3"):
# We can use the general texture shaders.
# XXX Should check separately for texture_shader2,
# otherwise it'll be SLOW.
@@ -88,7 +87,9 @@
pass
class ThePaperMill(PaperMill):
- paperopts = PaperOptions.instance()
+ def __init__(self):
+ self.paperopts = PaperOptions.instance()
+ self.newpaperopts = OpenGL11_PaperOptions()
def getPaper(self, seed, passmask=[1,1,1,1,1,1,1]):
pap = PaperHanger()
@@ -112,9 +113,12 @@
rootrep = TexGenXYRepeatUnit(rng, scale = 0.3 * scaleFactor)
pap.setNPasses(len(passes))
+
+ self.newpaperopts.setPassMask(passmask)
for i in range(0, len(passes)):
- if passmask[i]:
+ #if passmask[i]:
+ if self.newpaperopts.getPassMask()[i]:
passreg = pap.reg.sub("pass"+str(i))
passreg.get(regseed, "seed", seeds[i])
self.makePaperPass(passreg,
@@ -216,7 +220,7 @@
# We have at least a NV10, possibly better.
# Check the number of general combiners to be sure.
maxcomb = GL.getGLFloat("MAX_GENERAL_COMBINERS_NV")[0]
- #if maxcomb < 4:
+ #if maxcomb < 4:
if 1: #XXX NV20 version is broken
# use NV10 version
if dbg: print "Using NV10 combiners ",maxcomb
@@ -230,10 +234,9 @@
else:
# Must use OpenGL 1.1 specified calls.
print "Using OpenGL 1.1 texenv and blending"
- #from gfx.libpaper.texcomb_GL1_1 import *
texcomb = gfx.libpaper.texcomb_GL1_1
- gfx.libpaper.textures.texture_format = "LUMINANCE_ALPHA"
- gfx.libpaper.textures.texture_components = 2
+ self.paperopts.use_opengl_1_1 = 1
+
self.TransparentCombinerPass = texcomb.TransparentCombinerPass
self.DebugCombinerPass = texcomb.DebugCombinerPass
@@ -338,3 +341,62 @@
else:
if dbg: print "TexGen"+str(i), data
ppass.putNormalTexGen(i, data)
+
+
+# not fully used currently
+class OpenGL11_PaperOptions:
+ def __init__(self):
+ self.useOpengL11 = None
+ self.passMask = None
+ self.trueOpenGL11 = None
+ self.lastState = None
+
+ # Check which combiners to use.
+ if GL.hasExtension("GL_NV_register_combiners"):
+ self.trueOpenGL11 = 0
+ self.useOpenGL11 = 0
+ else:
+ self.trueOpenGL11 = 1
+ self.useOpenGL11 = 1
+
+ def getUseOpenGL11(self):
+ return self.useOpenGL11
+
+ def setUseOpenGL11(value):
+ if self.trueOpenGL11:
+ return
+ self.useOpenGL11 = value
+
+ def getPassMask(self):
+ return self.passMask
+
+ # XXX this is not very clever
+ def setPassMask(self, mask):
+ if self.useOpenGL11:
+ # XXXX self.passMask = mask[2:] + [0]
+ self.passMask = [1,1,1,0]
+ else:
+ self.passMask = [1,1,1,1]
+ #print 'passmask: ', self.passMask
+
+
+ def restoreState(self):
+ if not self.lastState:
+ print 'Error: lastState is None'
+ return
+
+ self.setUseOpenGL11(self.lastState.getUseOpenGL11() )
+ self.setPassMask(self.lastState.getPassMask() )
+ self.lastState = None
+
+ def saveState(self):
+ if self.lastState:
+ print 'Error: lastState is not None'
+ return
+
+ self.lastState = OpengGL11_PaperOptions()
+ self.lastState.setUseOpenGL11(self.getUseOpenGL11() )
+ self.lastState.setPassMask(self.getPassMask() )
+
+
+
- [Gzz-commits] gzz/gfx/libpaper papermill.py,
Matti Katila <=