21 |
|
|
22 |
if (GL.hasExtension("GL_NV_fragment_program")): |
if (GL.hasExtension("GL_NV_fragment_program")): |
23 |
profiles.append("NV_PROG") |
profiles.append("NV_PROG") |
24 |
|
profiles.append("NV_PROG2") |
25 |
|
|
26 |
if (GL.hasExtension("GL_NV_texture_shader")): |
if (GL.hasExtension("GL_NV_texture_shader")): |
27 |
profiles.append("NV_SHAD") |
profiles.append("NV_SHAD") |
77 |
|
|
78 |
print "Using profile:", profile |
print "Using profile:", profile |
79 |
|
|
80 |
if profile == "NV_PROG": |
if profile == "NV_PROG" or profile == "NV_PROG2": |
81 |
print "Using 2-vector HILO displacement texture with GL_NV_fragment_program" |
print "Using 2-vector HILO displacement texture with GL_NV_fragment_program" |
82 |
using_fragprog = 1 |
using_fragprog = 1 |
83 |
|
|
149 |
END |
END |
150 |
""" |
""" |
151 |
|
|
152 |
|
if profile == "NV_PROG2": |
153 |
|
# "Flood fill" implementation; NOT TESTED |
154 |
|
|
155 |
|
code = """ |
156 |
|
# f[TEX0].xyw texture coordinates |
157 |
|
# f[TEX2].xy texture HI and LO component weights |
158 |
|
# f[TEX2].w displacement (added to the weighted texture value) |
159 |
|
|
160 |
|
# Read texture |
161 |
|
TXP R0, f[TEX0], TEX0, 2D; |
162 |
|
|
163 |
|
# Weight, add displacement, and use as output color |
164 |
|
DP4 R0, R0, f[TEX2]; |
165 |
|
|
166 |
|
# R0 <- (R0 >= 1.0) |
167 |
|
SGE R0, R0, 1.0; |
168 |
|
|
169 |
|
# R1 <- 2 grad(R0) . grad(R0) |
170 |
|
DDX R1.x, R0; |
171 |
|
DDY R1.y, R0; |
172 |
|
DP4 R1, R1.xyxy, R1.xyxy; |
173 |
|
|
174 |
|
# R2 <- 2 grad(R1) . grad(R1) |
175 |
|
DDX R2.x, R1; |
176 |
|
DDY R2.x, R1; |
177 |
|
DP4 R2, R2.xyxy, R2.xyxy; |
178 |
|
|
179 |
|
# Use R1 + R2 > 0 as the output color |
180 |
|
ADD R1, R1, R2; |
181 |
|
SGE o[COLR], R1, 0.0; |
182 |
|
""" |
183 |
|
|
184 |
prog_outer = GL.createProgram(code) |
prog_outer = GL.createProgram(code) |
185 |
|
|
186 |
|
|
468 |
init() |
init() |
469 |
elif "F1" <= k <= "F9": |
elif "F1" <= k <= "F9": |
470 |
global profile |
global profile |
471 |
profile = profiles[int(k[1]) - 1] |
profile = profiles[int(k[1:]) - 1] |
472 |
init() |
init() |
473 |
elif k == "m": |
elif k == "m": |
474 |
global matrices |
global matrices |
909 |
if k == "Next": |
if k == "Next": |
910 |
self.angle += pi/180; print "angle",round(self.angle / pi * 180) |
self.angle += pi/180; print "angle",round(self.angle / pi * 180) |
911 |
reinit = 1 |
reinit = 1 |
912 |
if k == "Home": self.angle2 -= pi/180; self.angle += pi/180 |
if k == "Home": self.angle2 -= pi/180; self.angle += pi/180; reinit = 1 |
913 |
if k == "End": self.angle2 += pi/180; self.angle -= pi/180 |
if k == "End": self.angle2 += pi/180; self.angle -= pi/180; reinit = 1 |
914 |
|
|
915 |
if k == "i": self.use_stencil = not self.use_stencil |
if k == "i": self.use_stencil = not self.use_stencil |
916 |
|
|