2 |
from java.awt import Color |
from java.awt import Color |
3 |
from gzz.gfx.gl import GL, GLCache |
from gzz.gfx.gl import GL, GLCache |
4 |
|
|
5 |
w = getGraphicsWindow() |
win = getGraphicsWindow() |
6 |
|
|
7 |
print "GW: ",w |
print "GW: ",win |
8 |
bv = GL.createByteVector(10000) |
bv = GL.createByteVector(10000) |
9 |
|
|
10 |
def checkAvgColor(x, y, w, h, color): |
def checkAvgColor(x, y, w, h, color): |
11 |
bv.readFromBuffer_ubytes(w, "FRONT", x, y, w, h, "RGB") |
# We want to give the window coords differently |
12 |
|
bounds = win.window.getBounds() |
13 |
|
y = bounds.height - 1 - y |
14 |
|
bv.readFromBuffer_ubytes(win.window, "FRONT", x, y, w, h, "RGB") |
15 |
r = 0.0 |
r = 0.0 |
16 |
g = 0.0 |
g = 0.0 |
17 |
b = 0.0 |
b = 0.0 |
32 |
|
|
33 |
|
|
34 |
def testBgTriangle(): |
def testBgTriangle(): |
35 |
vs = w.createVobScene() |
vs = win.createVobScene() |
36 |
vs.map.put(SolidBgVob(Color.red)) |
vs.map.put(SolidBgVob(Color.red)) |
37 |
vs.map.put(GLCache.getCallList(""" |
vs.map.put(GLCache.getCallList(""" |
38 |
Color 0 1 0 |
Color 0 1 0 |
43 |
Vertex 200 100 |
Vertex 200 100 |
44 |
End |
End |
45 |
""")) |
""")) |
46 |
vs.coords.renderInterp(w, vs.map, None, None, 0, 1, 1) |
vs.coords.renderInterp(win, vs.map, None, None, 0, 1, 1) |
47 |
checkAvgColor(10, 10, 2, 2, (255, 0, 0)) |
checkAvgColor(10, 10, 2, 2, (255, 0, 0)) |
48 |
checkAvgColor(10, 10, 2, 2, (255, 0, 255)) |
checkAvgColor(110, 110, 2, 2, (0, 255, 0)) |
49 |
|
|
50 |
|
|
51 |
|
|