Hardware surfaces

Hi there,

I was trying to accelerate one application I’m doing in SDL by using
hardware double buffering, and I’m having some trouble. The code I use
to initialize the video mode is this one:

SDL_Surface* initializeSDL(int moreflags)
{
SDL_Surface *screen;

int flags = SDL_HWSURFACE|SDL_DOUBLEBUF|moreflags;
if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)<0) return 0;
atexit(SDL_Quit);
SDL_WM_SetCaption(application_name, 0);
SDL_ShowCursor(SDL_DISABLE);
SDL_EnableUNICODE(1);

screen = SDL_SetVideoMode(SCREEN_X, SCREEN_Y, COLOUR_DEPTH, flags);

return screen;

} /* initializeSDL */

where SCREEN_X, SCREEN_Y and COLOUR_DEPTH are “#define"d previously, and
"moreflags” usually contains the SDL_FULLSCREEN flag. My problem is the
following:
if I initialize the surface at 640x480 at 32bit color in fullscreen.
Everything works fine.
However, if I initialize a 800x600 at 23bit color screen, the computer
crashes after I call SDL_Flip() for second time (without HDSURFACES
everything works fine at any resolution).

This works with another computer (with a RADEON MOBILITY 32MB), but
crashed on mine (RIBA TNT2 32MB). I’m I doing something wrong? Or it’s
just that some cards don’t support HW surfaces for all the resolutions?
How can I check if the video mode has been set properly?

thanks in advance

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!Am Samstag, 7. Juni 2003 12:27 schrieb SANTI.ONTANON:

This works with another computer (with a RADEON MOBILITY 32MB), but
crashed on mine (RIBA TNT2 32MB). I’m I doing something wrong?

I am not an expert, but as to my knowledge not all cars support
hardware-doublebuffers in Windowed-Apps. I might be wrong on this, so …

matthias


Matthias Bach | GPG/PGP-Key-ID: 0xACA73EC9
www.marix-world.de | On Keyserver: www.keyserver.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+4dMvlnJmS6ynPskRAjWxAJ9alqZOnpe/Hv3Ctuv3gOrV4iSgjQCePq2Z
i6w8+DZUqCKIhN+AmQnqcm4=
=IsOA
-----END PGP SIGNATURE-----

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

This works with another computer (with a RADEON MOBILITY 32MB), but
crashed on mine (RIBA TNT2 32MB). I’m I doing something wrong?

I am not an expert, but as to my knowledge not all cars support
hardware-doublebuffers in Windowed-Apps. I might be wrong on this, so …

You are correct. In general you cannot expect to get a true windowed,
double buffered, hardware surface. It is more likely to work in full
screen mode, but still not guaranteed. You can also run into problems
caused by buggy drivers.

You must check the flags in the screens structure to make sure you got
what you wanted.

matthias

	Bob PendletonOn Sat, 2003-06-07 at 06:57, Matthias Bach wrote:

Am Samstag, 7. Juni 2003 12:27 schrieb SANTI.ONTANON:


Matthias Bach | GPG/PGP-Key-ID: 0xACA73EC9
www.marix-world.de | On Keyserver: www.keyserver.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+4dMvlnJmS6ynPskRAjWxAJ9alqZOnpe/Hv3Ctuv3gOrV4iSgjQCePq2Z
i6w8+DZUqCKIhN+AmQnqcm4=
=IsOA
-----END PGP SIGNATURE-----


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

±----------------------------------+

  • Bob Pendleton: independent writer +
  • and programmer. +
  • email: Bob at Pendleton.com +
    ±----------------------------------+