[SDL] Precise screen synchronization

Bob Pendleton bob at pendleton.com
Fri Sep 15 15:27:18 PDT 2006


On Fri, 2006-09-15 at 19:52 +0000, Daniel Rizzuto wrote:
> Hello, I am creating a double-buffered SDL application. This application
> requires that I synchronize buffer swaps to the VBL to avoid tearing and that I
> send a signal to the serial port as soon as the display has been updated with
> the new frame. Is there any way to know when the buffer swap that I requested
> has been executed? A blocking buffer-swap call would suffice for my purposes.
> Thank you.

It depends on whether you are using OpenGL or not. I am not sure of the
answer for OpenGL. For pure SDL using hardware double buffering, then
the SDL_LockSurface blocks until a swap has occurred and it is safe to
access the back buffer. The SDL_Flip function is not blocking. It just
sets up a swap and returns.

		Bob Pendleton

> 
> Best, Dan
> 
> 
> 
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
> 
-- 
+--------------------------------------+
+ Bob Pendleton: writer and programmer +
+ email: Bob at Pendleton.com             +
+ web: www.GameProgrammer.com          +
+ www.Wise2Food.com                    +
+ nutrient info on 7,000+ common foods +
+--------------------------------------+






More information about the SDL mailing list