It appears that doublebuff does not work on windows when in windowed mode.
The following code has been tested on Windows and Linux.
On Linux it works as expected, but in Windows it draws to the physical
screen even though no call has been made to update it.
It however works fine when in fullscreen.
Any ideas?
Thanks in advance,
Si.
#include <stdlib.h> #include “SDL.h”
int main(int argc, char *argv[])
{
SDL_Surface *screen;
It appears that doublebuff does not work on windows when in windowed mode.
The following code has been tested on Windows and Linux.
On Linux it works as expected, but in Windows it draws to the physical
screen even though no call has been made to update it.
This has been reported before. I’ll look into it if I can.
See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment
Sorry if you know about this already.
I have found out that its only when you call SDL_PollEvent that it triggers
the screen to be updated.
Im not very handy with a debugger, otherwise I would try and track it down.
Si.
At 11:09 10/01/02 -0800, you wrote:>> It appears that doublebuff does not work on windows when in windowed mode.
The following code has been tested on Windows and Linux.
On Linux it works as expected, but in Windows it draws to the physical
screen even though no call has been made to update it.
This has been reported before. I’ll look into it if I can.
See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment
It appears that doublebuff does not work on windows when in windowed mode.
The following code has been tested on Windows and Linux.
On Linux it works as expected, but in Windows it draws to the physical
screen even though no call has been made to update it.
It however works fine when in fullscreen.
if ( (screen=SDL_SetVideoMode(640, 480, 16, SDL_SWSURFACE|SDL_DOUBLEBUF))
It’s not very useful to use a sw surface with double buffering, it has no
sense at all double buffering in windowed mode. Double buffering is very
useful with HWSURFACEs in that way you can draw to the hidden buffer and
then swap it to the visible one without having to blit the new surface to
the screen. SWSURFACE means that you have to blit with UpdateRect(s) your
changes since your surface is really in the main memory of your computer,
so if you have to blit it to the visible buffer you have not to have also a
double buffer to hide your drawing operations. A double buffer with a SW
surface may be useful in a very fast scrolling game but only if the target
machine supports VBlank synchronization for the flip operation (a way to
delay surface flipping to the next time the physical CRT redraw operation
is arrived to the not visible area of the display), but in these cases it’s
almost the same thing to have double buffering on an HW screen, you’ll gain
a full screen blit each frame, maybe that if you are using alpha keying for
transparences the SWSURFACE may have sense since alpha keying needs to read
the background surface and reading from video memory is usually slow, so I
suggest you the following videomodes:
without alpha:
SDL_HWSURFACE|SDL_DOUBLEBUF: if fullscreen
SDL_SWSURFACE: if windowed
in the mainloop you can place something like:
if(fullscreen) SDL_Flip(); else SDL_UpdateRect(screen,0,0,0,0);
with alpha:
SDL_SWSURFACE: always
You may try SDL_DOUBLEBUF in the fullscreen case if you see video update
visual effects that you don’t like.