75 |
else: |
else: |
76 |
if dbg: print "Anisotropic filtering not available" |
if dbg: print "Anisotropic filtering not available" |
77 |
|
|
78 |
|
|
79 |
|
# The size of the texture for an optimized paper |
80 |
|
optimizedPaperSize=256 |
81 |
|
if not GL.workaroundStupidBuggyAtiDrivers: |
82 |
|
# With ATI drivers, we won't even try to optimize papers. |
83 |
|
# With others, create a stable offscreen surface on which |
84 |
|
# to render the papers |
85 |
|
optimizingWindow = vob.GraphicsAPI.getInstance().createStableOffscreen(optimizedPaperSize, optimizedPaperSize) |
86 |
|
|
87 |
dbg = 0 |
dbg = 0 |
88 |
|
|
185 |
# Now, we render a region. |
# Now, we render a region. |
186 |
v = pap.repeat._getSTVectors() |
v = pap.repeat._getSTVectors() |
187 |
|
|
188 |
s = 256 |
vs = optimizingWindow.createVobScene() |
|
vs = w.createVobScene() |
|
189 |
vs.map.put(vob.vobs.SolidBackdropVob(java.awt.Color.red)) |
vs.map.put(vob.vobs.SolidBackdropVob(java.awt.Color.red)) |
190 |
|
|
191 |
cs1 = vs.coords.ortho(0, 0, 0, 0, s+1, s+1) |
cs1 = vs.coords.ortho(0, 0, 0, 0, |
192 |
|
optimizedPaperSize+1, optimizedPaperSize+1) |
193 |
cs2 = vs.coords.affine( |
cs2 = vs.coords.affine( |
194 |
0, 0, 0, 0, |
0, 0, 0, 0, |
195 |
v[0][0], v[0][1], v[1][0], v[1][1] |
v[0][0], v[0][1], v[1][0], v[1][1] |
196 |
) |
) |
197 |
vs.map.put(GLRen.createPaperQuad(pap, 0, 0, 1, 1, 1), |
vs.map.put(GLRen.createPaperQuad(pap, 0, 0, 1, 1, 1), |
198 |
cs1, cs2) |
cs1, cs2) |
199 |
w.renderStill(vs, 1) |
optimizingWindow.renderStill(vs, 1) |
200 |
|
|
201 |
tex = GL.createTexture() |
tex = GL.createTexture() |
202 |
texid = tex.getTexId() |
texid = tex.getTexId() |
209 |
BindTexture TEXTURE_2D 0 |
BindTexture TEXTURE_2D 0 |
210 |
""" % locals()) |
""" % locals()) |
211 |
|
|
|
if dbg: |
|
|
print "READ: ", 0, vs.getSize().height-1-s, s, s |
|
212 |
|
|
213 |
tex.copyTexImage2D(w.getRenderingSurface(), |
tex.copyTexImage2D(optimizingWindow.getRenderingSurface(), |
214 |
"FRONT", "TEXTURE_2D", 0, |
"FRONT", "TEXTURE_2D", 0, |
215 |
"RGB", 0, vs.getSize().height-1-s, |
"RGB", 0, 0, |
216 |
s, s, 0) |
optimizedPaperSize, optimizedPaperSize, 0) |
217 |
|
|
218 |
if dbg: |
if dbg: |
219 |
vob.putil.texture.printTex(tex.getTexId()) |
vob.putil.texture.printTex(tex.getTexId()) |