[SDL] depth buffer

Rasmus Neckelmann neckelmann at gmail.com
Wed Nov 22 03:21:45 PST 2006


> Are there any tutorials around for using SDL with the OpenGL Z (depth)
> buffer? I need to do a lot of work with overlaid images and know nothing
> about this!!

Depth-buffering is very simple in OpenGL. Just make sure to call

SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE,32);

before calling SDL_SetVideoMode(). Note that a 32-bit depth-buffer is
requested - it's most likely not possible to get, but it assures that
you'll be supplied with the best possible bit-resolution (24 bits on
most recent video hardware).

>From this point it's just plain OpenGL, no more SDL specifics. I'll
suggest you to read NeHe's OpenGL tutorials, they're very good:
http://nehe.gamedev.net

Also check out:  http://www.libsdl.org/opengl/index.php

-- 
Regards,
Rasmus Neckelmann




More information about the SDL mailing list