View Full Version : SDL question

07-07-2003, 08:16 AM
I'm new to SDL and I'm very impressed with the fact that it's portable and its elegance and simplicity compared to WIN32.

I used the example program from the SDL site ( 2-8. SDL and OpenGL ). From what I've read and observed while running this example, SDL can emulate whatever screen size you give it so setting a width of 102 and a height of 768 works. I want this program to only use a valid hardware resolution and the minimum color depth must be 16 bit. So I modified the code slightly. It seems to work and when I enter arbitrary widths and heights it fails. Is this a fullproof method? I've only tested it on Win2K Pro.

width = 1024;
height = 768;
bpp = info->vfmt->BitsPerPixel;

cout << "Color depth = " << bpp << " bit"; // not neccessary just outputs the color depth to stdout.txt

if ( bpp <16)
cerr << "Desktop color depth must be at least 16 bit ( High Color )";
quit_tutorial( 1 );

bpp=SDL_VideoModeOK(1024, 768, 32, SDL_FULLSCREEN); // no emulation if resolution is unsupported

cerr << "Mode not available.\n";
quit_tutorial ( 1 );

07-07-2003, 12:38 PM
SDL uses the old-style pixel format descriptors, so you'll have trouble using such things as pbuffers that need WGL_ARB_pixel_format.

For more SDL support, please go to the SDL forums and mailing lists, as you're much more likely to get good help there.