[PATCH] SDL_MasksToPixelFormatEnum() and 24 bits


I was playing with SDL 1.3 and SDL_image from svn, in order to load
image files and create OpenGL textures. In my code, I did something
similar to GL_CreateTexture() (in src/video/SDL_renderer_gl.c) but
encountered an issue: SDL_MasksToPixelFormatEnum() doesn’t handle 24
bits images.

Since I hadn’t more time to play with SDL, I just reported a bug:

I attached to this mail a small patch to fix 24 bpp image handling in
SDL_MasksToPixelFormatEnum(), but this raises a new issue: this function
doesn’t handle endianess at all.
Is it normal? Or am I doing it wrong in my application when creating my
texture from an SDL surface?

Note that my goal is to create an OpenGL texture with image’s original
pixel format (for example, I don’t want to convert a 8 bits grayscale
image to RGB but use GL_UMINANCE format).

-------------- next part --------------
A non-text attachment was scrubbed…
Name: MasksToPixelFormatEnum-24bpp.diff
Type: text/x-patch
Size: 497 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20080831/3a6f4982/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed…
Name: img-gl.c
Type: text/x-csrc
Size: 9926 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20080831/3a6f4982/attachment.c