[SDL] Re: SDL, MacOS & OpenGL

Christian Walther cwalther at gmx.ch
Mon Jun 27 01:31:26 PDT 2005

Michael L. wrote:
> I am trying to support four display types:
> MacOSx Software Blits
> MacOSx OpenGL textured quad rendering
> Win32  Software Blits
> Win32  OpenGL textured quad rendering
> I have everything up and running through the same code path except 
> MacOSx OpenGL textured quad rendering.

It would help if you would tell us what doesn't work there. Do the 
colors come out wrong? In that case, maybe you're not considering 
endianness when pixels are written as 4-byte integers, then read 
byte-by-byte by OpenGL. Here's what I do, tested on Mac OS X (PPC), 
Linux (PPC & x86), and Windows (x86):

#define BYTEORDER_DEPENDENT_RGBA_MASKS 0xFF000000, 0x00FF0000, 
0x0000FF00, 0x000000FF
#define BYTEORDER_DEPENDENT_RGBA_MASKS 0x000000FF, 0x0000FF00, 
0x00FF0000, 0xFF000000
face = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32, 
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, 
GL_UNSIGNED_BYTE, face->pixels);


More information about the SDL mailing list