[SDL] SDL Surfaces and OpenGL

Stephane Marchesin stephane.marchesin at wanadoo.fr
Mon Nov 14 09:59:48 PST 2005


Roger D. Vargas wrote:
> El vie, 11-11-2005 a las 22:03, Antonio SJ Musumeci escribió:
> 
>>You could use glRenderPos and glDrawPixels.
> 
> Yes, thats what I mean. But how cna you convert an sdl surface to the
> data use by gldrawpixels?
> Whats the method used by glSDL to accelerate blits via open gl? 
> 

It creates a texture and blits it to screen. Creating a texture has been 
measured to be _way_ faster on ATI cards as opposed to using 
glDrawPixels, and a bit slower on NVIDIA cards. So it looks like a good 
compromise.

The simplest way to convert the surface format is to use SDL_BlitSurface 
from your original surface to (for example) a RGBA8 SDL surface, which 
is then perfectly suitable as an OpenGL texture source.

Stephane





More information about the SDL mailing list