Problem with SDL_DOUBLEBUF

Hello,

my problem is that I cannot enable the Double-Buffering Mode.
The expression ((screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF)
is false.
I’m sure that my hardware supports Double-Buffering.
An extract of my code:

if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER))
{
fprintf(stderr, “%s\n”, SDL_GetError());
return 1;
}
atexit(SDL_Quit);

if ((screen = SDL_SetVideoMode(800, 600, 16,  SDL_HWSURFACE |

SDL_DOUBLEBUF)) == NULL)
{
fprintf(stderr, “%s\n”, SDL_GetError());
return 1;
}

if ((screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF)
    puts("DOUBLEBUF enabled");
else
    puts("DOUBLEBUF disabled");

Everytime “DOUBLEBUF disabled” is printed.

With SDL_FULLSCREEN it doesn’t work either.
Yes, I’m using Linux.
So I always have to use SDL_UpdateRects ?Am Mittwoch, 10. August 2005 12:31 schrieb dm2 at red.madritel.es:

You could try to add SDL_FULLSCREEN flag to SDL_SetVideoMode().
If you are using DDraw backend…you will get hardware support only on
fullscreen modes. glSDL for example, you could use doublebuffer+hardware on
fullscreen and window mode.

If you are using Linux or another platform… it depends on the video
backend that you used to. Some of them…don’t have hardware acceleration
at all!

good luck!

---- Alexander Lange <@Alexander_Lange> escribi?:

Hello,

my problem is that I cannot enable the Double-Buffering Mode.
The expression ((screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF)
is false.
I’m sure that my hardware supports Double-Buffering.
An extract of my code:

if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER))
{
fprintf(stderr, “%s\n”, SDL_GetError());
return 1;
}
atexit(SDL_Quit);

if ((screen = SDL_SetVideoMode(800, 600, 16,  SDL_HWSURFACE |

SDL_DOUBLEBUF)) == NULL)
{
fprintf(stderr, “%s\n”, SDL_GetError());
return 1;
}

if ((screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF)
    puts("DOUBLEBUF enabled");
else
    puts("DOUBLEBUF disabled");

Everytime “DOUBLEBUF disabled” is printed.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

I think SDL_DOUBLEBUF doesn’t work because SDL_HWSURFACE doesn’t work either.
But why? I have 64 MB RAM on my video card.
The Program xvidinfo that comes with the SDL source gives the following output
(extract):

Video driver: x11
Current display: 16 bits-per-pixel
Red Mask = 0x0000f800
Green Mask = 0x000007e0
Blue Mask = 0x0000001f
Fullscreen video modes:
1280x1024x16
1280x960x16
1152x864x16
1152x864x16
1024x768x16
1024x768x16
800x600x16
800x600x16
700x525x16
640x512x16
640x480x16
640x480x16
512x384x16
512x384x16
400x300x16
320x240x16
A window manager is available===================================
Setting video mode: 640x480 at 8 bpp, flags: 0x00000000 SDL_SWSURFACE
Running color fill and fullscreen update test
768 fills and flips in 3.08 seconds, 249.51 FPS
Running freshly loaded blit test: 408x167 at 8 bpp, flags: 0x00000000
SDL_SWSURFACE
5000 blits / 500 updates in 2.63 seconds, 189.83 FPS
Running freshly loaded cc blit test: 408x167 at 8 bpp, flags: 0x00003000
SDL_SWSURFACE | SDL_SRCCOLORKEY | SDL_RLEACCELOK
5000 cc blits / 500 updates in 3.57 seconds, 140.13 FPS
Running display format blit test: 408x167 at 8 bpp, flags: 0x00000000
SDL_SWSURFACE
5000 blits / 500 updates in 2.34 seconds, 213.31 FPS
Running display format cc blit test: 408x167 at 8 bpp, flags: 0x00003000
SDL_SWSURFACE | SDL_SRCCOLORKEY | SDL_RLEACCELOK
5000 cc blits / 500 updates in 2.31 seconds, 215.98 FPS

Setting video mode: 640x480 at 8 bpp, flags: 0x80000000 SDL_SWSURFACE |
SDL_FULLSCREEN
Running color fill and fullscreen update test
768 fills and flips in 2.88 seconds, 266.39 FPS
Running freshly loaded blit test: 408x167 at 8 bpp, flags: 0x00000000
SDL_SWSURFACE
5000 blits / 500 updates in 2.51 seconds, 199.12 FPS
Running freshly loaded cc blit test: 408x167 at 8 bpp, flags: 0x00003000
SDL_SWSURFACE | SDL_SRCCOLORKEY | SDL_RLEACCELOK
5000 cc blits / 500 updates in 2.96 seconds, 168.86 FPS
Running display format blit test: 408x167 at 8 bpp, flags: 0x00000000
SDL_SWSURFACE
5000 blits / 500 updates in 2.24 seconds, 222.92 FPS
Running display format cc blit test: 408x167 at 8 bpp, flags: 0x00003000
SDL_SWSURFACE | SDL_SRCCOLORKEY | SDL_RLEACCELOK
5000 cc blits / 500 updates in 2.21 seconds, 226.04 FPS

Setting video mode: 640x480 at 8 bpp, flags: 0x80000001 SDL_HWSURFACE |
SDL_FULLSCREEN
Flags didn’t match: 0x80000000 SDL_SWSURFACE | SDL_FULLSCREEN

Setting video mode: 640x480 at 8 bpp, flags: 0xc0000001 SDL_HWSURFACE |
SDL_FULLSCREEN | SDL_DOUBLEBUF
Flags didn’t match: 0x80000000 SDL_SWSURFACE | SDL_FULLSCREEN

Am Mittwoch, 10. August 2005 15:34 schrieb Alexander Lange:

With SDL_FULLSCREEN it doesn’t work either.
Yes, I’m using Linux.
So I always have to use SDL_UpdateRects ?

Am Mittwoch, 10. August 2005 12:31 schrieb dm2 at red.madritel.es:

You could try to add SDL_FULLSCREEN flag to SDL_SetVideoMode().
If you are using DDraw backend…you will get hardware support only on
fullscreen modes. glSDL for example, you could use doublebuffer+hardware
on fullscreen and window mode.

If you are using Linux or another platform… it depends on the video
backend that you used to. Some of them…don’t have hardware acceleration
at all!

good luck!

---- Alexander Lange <@Alexander_Lange> escribi?:

Hello,

my problem is that I cannot enable the Double-Buffering Mode.
The expression ((screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF)
is false.
I’m sure that my hardware supports Double-Buffering.
An extract of my code:

if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER))
{
fprintf(stderr, “%s\n”, SDL_GetError());
return 1;
}
atexit(SDL_Quit);

if ((screen = SDL_SetVideoMode(800, 600, 16,  SDL_HWSURFACE |

SDL_DOUBLEBUF)) == NULL)
{
fprintf(stderr, “%s\n”, SDL_GetError());
return 1;
}

if ((screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF)
    puts("DOUBLEBUF enabled");
else
    puts("DOUBLEBUF disabled");

Everytime “DOUBLEBUF disabled” is printed.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Alexander Lange a ?crit :

I think SDL_DOUBLEBUF doesn’t work because SDL_HWSURFACE doesn’t work either.
But why?

Because X11 doesn’t support hw surfaces.

Stephane