[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pygame] Asynchronous updates with OpenGL



I'm working on a first person 3d maze using pygame and pyopengl 1.5.7.

My event loop waits for a keydown event, then loops using
pygame.key.get_pressed() to see which keys are pressed, and then updating
the camera position and calling pygame.display.flip().

The problem I'm running into is this: pygame.display.flip() doesn't block
until I have about 20 updates queued, making my reading of the keyboard run
far ahead of the frame rate, so I have to sit there and wait for it to
catch up. I absolutely *do not* want late updates of the screen. I'd rather
drop frames if things are too slow. Is there a way I can either get
pygame.display.flip() to block or at least get an event posted when the
screen is done updating?

-- 
Sean R. Lynch KG6CVV <seanl@chaosring.org>   http://www.chaosring.org/~seanl/
Jabber (www.jabber.org): kg6cvv@jabber.org   Yahoo: kg6cvv

PGP signature