18 |
import java |
import java |
19 |
from java.lang import Math |
from java.lang import Math |
20 |
|
|
21 |
#def initialize(): |
dbg=1 |
22 |
if 1: |
# Discriminate between different renderers. |
23 |
#global initialized |
# These are for debug output only. |
24 |
#if initialized: return |
if dbg: |
25 |
#initialized = 1 |
vendor = GL.getGLString("VENDOR") |
26 |
dbg=1 |
renderer = GL.getGLString("RENDERER") |
27 |
# Discriminate between different renderers. |
version = GL.getGLString("VERSION") |
28 |
# These are for debug output only. |
print "GL strings: '%s' '%s' '%s'"%( |
29 |
if dbg: |
vendor,renderer,version) |
30 |
vendor = GL.getGLString("VENDOR") |
|
31 |
renderer = GL.getGLString("RENDERER") |
# |
32 |
version = GL.getGLString("VERSION") |
# Now, go through some questions. |
33 |
print "GL strings: '%s' '%s' '%s'"%( |
# |
34 |
vendor,renderer,version) |
|
35 |
# The backend files to load |
# Check which texture operations to use. |
36 |
files = [ |
if GL.hasExtension("GL_NV_texture_shader"): |
37 |
#"textures.py", |
# We can use the general texture shaders. |
38 |
#"texcoords.py", |
# XXX Should check separately for texture_shader2, |
39 |
#"colors.py", |
# otherwise it'll be SLOW. |
40 |
#"params.py" |
if dbg: print "Using NV20 texture shaders" |
41 |
] |
my_import("gfx.libpaper.texops_NV2X") |
42 |
|
from gfx.libpaper.texops_NV2X import * |
43 |
# |
else: |
44 |
# Now, go through some questions. |
if dbg: print "Using unextended OpenGL texture accesses" |
45 |
# |
my_import("gfx.libpaper.texops_STD") |
46 |
|
from gfx.libpaper.texops_STD import * |
47 |
# Check which texture operations to use. |
|
48 |
if GL.hasExtension("GL_NV_texture_shader"): |
|
49 |
# We can use the general texture shaders. |
# Check which combiners to use. |
50 |
# XXX Should check separately for texture_shader2, |
if GL.hasExtension("GL_NV_register_combiners"): |
51 |
# otherwise it'll be SLOW. |
# We have at least a NV10, possibly better. |
52 |
if dbg: print "Using NV20 texture shaders" |
# Check the number of general combiners to be sure. |
53 |
#files.append("texops_NV2X.py") |
maxcomb = GL.getGLFloat("MAX_GENERAL_COMBINERS_NV")[0] |
54 |
my_import("gfx.libpaper.texops_NV2X") |
if maxcomb < 4: |
55 |
from gfx.libpaper.texops_NV2X import * |
# use NV10 version |
56 |
|
if dbg: print "Using NV10 combiners ",maxcomb |
57 |
else: |
my_import("gfx.libpaper.texcomb_NV1X") |
58 |
if dbg: print "Using unextended OpenGL texture accesses" |
from gfx.libpaper.texcomb_NV1X import * |
|
#files.append("texops_STD.py") |
|
|
my_import("gfx.libpaper.texops_STD") |
|
|
from gfx.libpaper.texops_STD import * |
|
|
|
|
|
|
|
|
# Check which combiners to use. |
|
|
if GL.hasExtension("GL_NV_register_combiners"): |
|
|
# 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: |
|
|
# use NV10 version |
|
|
if dbg: print "Using NV10 combiners ",maxcomb |
|
|
#files.append("texcomb_NV1X.py") |
|
|
my_import("gfx.libpaper.texcomb_NV1X") |
|
|
from gfx.libpaper.texcomb_NV1X import * |
|
|
else: |
|
|
# use NV20 version |
|
|
if dbg: print "Using NV20 combiners ",maxcomb |
|
|
#files.append("texcomb_NV2X.py") |
|
|
my_import("gfx.libpaper.texcomb_NV2X") |
|
|
from gfx.libpaper.texcomb_NV2X import * |
|
59 |
else: |
else: |
60 |
assert 0, "Sorry, can't do without NVIDIA register combiners yet." |
# use NV20 version |
61 |
|
if dbg: print "Using NV20 combiners ",maxcomb |
62 |
for f in files: |
my_import("gfx.libpaper.texcomb_NV2X") |
63 |
print "Load file ",f |
from gfx.libpaper.texcomb_NV2X import * |
64 |
execfile("gfx/libpaper/"+f, globals()) |
else: |
65 |
|
assert 0, "Sorry, can't do without NVIDIA register combiners yet." |
66 |
|
|
67 |
dbg = 0 |
dbg = 0 |
68 |
|
|
90 |
Disable BLEND |
Disable BLEND |
91 |
Enable DEPTH_TEST |
Enable DEPTH_TEST |
92 |
DepthFunc LESS |
DepthFunc LESS |
93 |
Color %(color)s |
Color %s %s %s |
94 |
""" % { |
""" % color) |
|
"color" : js(color), |
|
|
}) |
|
95 |
pas.setTeardowncode(""" |
pas.setTeardowncode(""" |
96 |
PopAttrib |
PopAttrib |
97 |
""") |
""") |
128 |
rootrep = TexGenXYRepeatUnit(rng) |
rootrep = TexGenXYRepeatUnit(rng) |
129 |
|
|
130 |
pap.setNPasses(len(passes)) |
pap.setNPasses(len(passes)) |
|
#setSolidPass(pap.getPass(0), (0.1,0.1,0.2)) |
|
131 |
|
|
132 |
for i in range(0, len(passes)): |
for i in range(0, len(passes)): |
133 |
if passmask[i]: |
if passmask[i]: |