[SDL] 16 bits textures and SDL

Stephane Marchesin stephane.marchesin at wanadoo.fr
Sat Jul 19 04:33:01 PDT 2003


gamedev srt wrote:

>
>
>glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA4, 256, 256, 0,
>GL_RGBA, GL_UNSIGNED_BYTE, dataImage);
>
Using GL_RGBA, GL_UNSIGNED_BYTE means that you're telling OpenGL to read 
4 unsigned bytes per pixel (RGBA8). But your SDL surface is in RGBA4 
format. So you need something like :

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA4, 256, 256, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, dataImage);

GL_RGBA4 is just OpenGL's internal texture format (ie how the texture is 
stored on your video card).


Stephane






More information about the SDL mailing list