I have no idea why, but I've discovered that on my machine (17"
Macbook Pro with 2.33 Core 2 Duo, see software specs above) the
expected behavior (white, blue, white) is achieved by placing a call
to "image.get_buffer_manager().get_color_buffer().image_data" before
the first call to flip(). Anyone have any ideas why this might be?

import pyglet
from pyglet.window import Window
from pyglet.gl import *
from pyglet.clock import tick
from pyglet import image

def wait(t):
        tick()
        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)
image.get_buffer_manager().get_color_buffer().image_data
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)


On Jan 2, 6:11 pm, "Alex Holkner" <[EMAIL PROTECTED]> wrote:
> On 1/3/08, Mike Lawrence <[EMAIL PROTECTED]> wrote:
>
>
>
> > 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.
>
> The contents of the front buffer is undefined after a flip; some video
> drivers preserve the front buffer as you expect, others don't.  Some
> OpenGL drivers provide a way to specify the behaviour, but pyglet does
> not export this option.
>
> Regardless, when double-buffering, the buffer that is being written to
> is different from the one being displayed.
>
> Alex.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to