OK, I know that SDL_Flip shows the double buffer. Could somebody tell
me how to draw to the double buffer?
OK, I know that SDL_Flip shows the double buffer. Could somebody tell
me how to draw to the double buffer?
The same way you draw to any other surface…
if ( SDL_MUSTLOCK(screen) ) {
if ( SDL_LockSurface(screen) < 0 ) {
return;
}
}
dst = (Uint8 )screen->pixels + yscreen->pitch + x*screen->format->BytesPerPixel;
*dst = 0;
if ( SDL_MUSTLOCK(screen) ) {
SDL_UnlockSurface(screen);
}
-Sam Lantinga (slouken at devolution.com)
Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec
John Garrison wrote:
OK, I know that SDL_Flip shows the double buffer. Could somebody tell
me how to draw to the double buffer?
Everything you draw is automatically drawn onto the double buffer when
you use |SDL_DOUBLEBUFFER .
The game I am working on has a game loop that does SDL_PollEvent to check for key presses, then draws a background image, draws about 72 pieces, and then draws a selector. The problem is that it flickers very badly. I don’t know how to explain it but it is a very very fast flicker.
I saw a tutorial that used SDL_Flip() and so I put that in there and it makes no difference. I have SDL_DOUBLEBUF set and SDL_Flip() is returning 0 every time.
How do you prevent the flickering when it redrawing so fast?
http://www.libsdl.org/pipermail/sdl/2002-February/042329.html
found via
http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=sdl_flip()+flicke
r
HTH> ----- Original Message -----
From: rucker@runbox.com (Michael G Rucker)
To:
Sent: Thursday, February 27, 2003 8:55 AM
Subject: [SDL] SDL_Flip()The game I am working on has a game loop that does SDL_PollEvent to check
for key presses, then draws a background image, draws about 72 pieces, and
then draws a selector. The problem is that it flickers very badly. I don’t
know how to explain it but it is a very very fast flicker.I saw a tutorial that used SDL_Flip() and so I put that in there and it
makes no difference. I have SDL_DOUBLEBUF set and SDL_Flip() is returning 0
every time.How do you prevent the flickering when it redrawing so fast?
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
An embedded and charset-unspecified text was scrubbed…
Name: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20040326/3bdc4ec8/attachment.txt
Hi all,
I am having a bit of trouble with SDL_Flip(). In particular I have following doubts (I have seen the code, it calls some directx5 func, but I don’t know anything about directx):
Note that I am talking about HARDWARE DOUBLE BUFFERED surfaces.
- What Happens when I call SDL_Flip() twice in quick succession?
- Suppose I blit some data and call SDL_Flip(). SDL_Flip() sets up a hardware Flip and returns. Assume that Surface has not been flipped yet.
Now I again try to blit data to the surface.Will it be immediately blitted to the current surface (One before SDL_Flip()) or SDL_BlitSurface() will wait until page flip happens and then blit it?
Once you have scheduled a flip all further graphics operations take
place on the new back buffer. Depending on the architecture of your
graphics card they may block until the flip happens, or there may be a
third (hidden) buffer that becomes the back buffer. But, not matter
what, once you schedule a flip all graphics operation are now directed
to the back buffer.
Bob PendletonOn Fri, 2004-03-26 at 12:22, pallavnawani at sancharnet.in wrote:
If it is immediately blitted, what will happen if Page Flipping happens when the blit is say, halfway through?
Thanks in advance,
Pallav Nawani
–
±--------------------------------------+
- Bob Pendleton: writer and programmer. +
- email: Bob at Pendleton.com +
- web: www.GameProgrammer.com +
±--------------------------------------+