Precise Behavior of SDL - Flip and Hardware Buffers - SDL Development - Simple Directmedia Layer
Precise Behavior of SDL - Flip and Hardware Buffers - SDL Development - Simple Directmedia Layer
To me that means that the call returns immediately but the next action
that locks the buffer will be forced to wait until after the next
vertical retrace before the lock can complete. But, when I test this
function on my machine I see that SDL_Flip() does not return
immediately. It appears to return after the next vertical retrace. My
guess is that the documentation is correct for some platforms and wrong
for others. My guess is that depending on the platform the actual
behavior of SDL_Flip() is all of the following:
2. The flip takes place at the next video retrace, but SDL_Flip()
returns immediately. Possibly returning before the flip has happened.
3. The Flip takes place at the next video retrace, and SDL_Flip()
returns after the flip has happened.
Thanks!
Bob Pendleton--
±----------------------------------+
Hi I’am also interested by these questions. Here is the problem, which may
be included in one of these questions, I have encountered with SDL_Flip.
I have made my game’s logic independent of the video frame rate. My idea was
to move sprites according to the time elapsed since the last move, and to
display as much frames as possible. This worked fine under linux with X or
the frame buffer, and under windows in windowed mode. In fullscreen
(DoubleBuf) mode with Windows the game speed was well synchronized on the
game clock (objets’ speed was ok) but I lose a lot of frames. I found that
calling SDL_Flip only every 7-10 ms solved the problem, but I wasn’t
satisfied by this solution. My actual solution is to embed the SDL_Flip into
a loop to test the returned result: while (SDL_Flip(screen) < 0); . This
means that some calls to SDL_FLip can fail. What are the reason to SDL_Flip
fail ? Is it a directX related reason ? If the answer completly unrelated
to Bob’s questions please change the subject to something like “SDL_FLip
errors” to not polute this thread.
Thanks
To me that means that the call returns immediately but the next action
that locks the buffer will be forced to wait until after the next
vertical retrace before the lock can complete. But, when I test this
function on my machine I see that SDL_Flip() does not return
immediately. It appears to return after the next vertical retrace. My
guess is that the documentation is correct for some platforms and wrong
for others. My guess is that depending on the platform the actual
behavior of SDL_Flip() is all of the following:
2. The flip takes place at the next video retrace, but SDL_Flip()
returns immediately. Possibly returning before the flip has happened.
3. The Flip takes place at the next video retrace, and SDL_Flip()
returns after the flip has happened.
Thanks!
Bob Pendleton
–
±----------------------------------+
To me that means that the call returns immediately but the next action
that locks the buffer will be forced to wait until after the next
vertical retrace before the lock can complete. But, when I test this
function on my machine I see that SDL_Flip() does not return
immediately. It appears to return after the next vertical retrace. My
guess is that the documentation is correct for some platforms and wrong
for others. My guess is that depending on the platform the actual
behavior of SDL_Flip() is all of the following:
2. The flip takes place at the next video retrace, but SDL_Flip()
returns immediately. Possibly returning before the flip has happened.
3. The Flip takes place at the next video retrace, and SDL_Flip()
returns after the flip has happened.
See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment
To me that means that the call returns immediately but the next action
that locks the buffer will be forced to wait until after the next
vertical retrace before the lock can complete. But, when I test this
function on my machine I see that SDL_Flip() does not return
immediately. It appears to return after the next vertical retrace. My
guess is that the documentation is correct for some platforms and wrong
for others. My guess is that depending on the platform the actual
behavior of SDL_Flip() is all of the following:
2. The flip takes place at the next video retrace, but SDL_Flip()
returns immediately. Possibly returning before the flip has happened.
3. The Flip takes place at the next video retrace, and SDL_Flip()
returns after the flip has happened.