Quote Originally Posted by jdarling
Now if someone only knew how to use SDL surfaces on OpenGL surfaces . At least every time I've tried it didn't work .
This is how I would use SDL surfaces with OpenGL.

I. reading from buffer to SDL_Surface
- create sdl surface 24 or 32 bpp (or convert existing one) depending if you want alpha or not
- call glReadPixels
example:
[pascal]
surface := SDL_CreateRGBSurface(SDL_SWSURFACE,w,h,32,rmask,gm ask,bmask,amask);
glReadPixels(x,y,w,h,GL_RGBA,GL_UNSIGNED_BYTE,surf ace^.pixels);
[/pascal]

II. SDL_Surface to OpenGL texture
- Again, load/create surface and convert to 24 or 32 bpp
- create openGL texture from surface's data for example like this
[pascal]
function MakeTexture(surf : PSDL_Surface) : gluint;
var
texID,tex_fmt : gluint;
begin
glGenTextures( 1, @texID );
glBindTexture( GL_TEXTURE_2D, TexID );
//setup some texture parameters
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );

if surf^.format.bitPerPixel = 32 then
tex_fmt := GL_RGBA
else
tex_fmt := GL_RGB;

glTexImage2D( GL_TEXTURE_2D,
0,
tex_fmt,
surf^.w, surf^.h,
0,
tex_fmt,
GL_UNSIGNED_BYTE,
surf^.pixels );
Result := texID;
end;
[/pascal]

III. Read OpenGL texture to SDL_Surface
- As always create/convert to proper pixel format
- call glGetTexImage

IV. Copy SDL surface directly to OpenGL color buffer (very slow)
- Prepare surface
- call glDrawPixels

I hope it helps.