4 |
from gzz.gfx.gl import GL |
from gzz.gfx.gl import GL |
5 |
import os |
import os |
6 |
|
|
7 |
def saveframe(filename, win): |
def save(): |
8 |
x,y = 0,0 |
x,y = 0,0 |
9 |
s = win.getSize() |
s = win.getSize() |
10 |
w,h = s.width, s.height |
colors = win.readPixels(0, 0, s.width, s.height) |
|
|
|
|
v = GL.createByteVector(w * h * 3) |
|
|
v.readFromBuffer_ubytes(win.window, "FRONT", x, y, w, h, "RGB") |
|
|
barr = v.get() |
|
|
f = FileOutputStream("img.tmp") |
|
|
f.write(barr) |
|
|
f.close() |
|
|
os.system("rawtoppm %(w)s %(h)s img.tmp | pnmflip -tb | pnmtojpeg >%(filename)s" % locals()) |
|
11 |
|
|
12 |
def savesequence(win, filebase, vs1, vs2, n): |
def savesequence(win, filebase, vs1, vs2, n): |
13 |
for frame in range(0, n+1): |
for frame in range(0, n+1): |