The documentation reports that the default graphics are double-
buffered, which (as I understand the term 'double-buffered') means
that the following code should present a white square on a black
screen for 2 seconds, then a blue square on a black screen for 2
seconds, then the white square again for 2 seconds. However, when I
run it (pyglet 1.0beta3 with python 2.5 on OS 10.5.1), I get a white
square for 2 seconds, and a blue square for 4 seconds.
import pyglet
from pyglet.window import Window
from pyglet.gl import *
from pyglet.clock import tick
def wait(t):
dt=0
while dt < t:
dt=dt+tick()
size=100
win=Window()
win.x_center=win.width/2
win.y_center=win.height/2
win.dispatch_events()
#writing to buffer #1
win.clear()
glColor3f(1,1,1)
glRectf(win.x_center-size, win.y_center-size,win.x_center
+size,win.y_center+size)
win.flip() #Show buffer #1
wait(2)
#writing to buffer #2
win.clear()
glColor3f(0,0,1)
glRectf(win.x_center-size, win.y_center-size,win.x_center
+size,win.y_center+size)
win.flip() #show buffer #2
wait(2)
win.flip() #flip back to buffer #1
wait(2)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---