[SDL] SDL/OpenGL and texture mapping.
matthias at zislers.de
Tue Sep 10 10:09:00 PDT 2002
> Could you briefly expain what this code does? It looks like you are
> creating a surface with alpha for every image, bliting the image to it
> and using it to create a texture. It doesn't really explain my I am
> loosing a channel when creating the texture. Thank you for the code, I
> will try it out and see if it fixes my problem.
Loosing a channel, is very rare execpt the alpha channel, as far as I
can remember my first tries to load a texture with SDL failed too. The
Texture was looking freaky, I played around with GL_RGB and GL_RGBA but
nothing helped sometimes it worked sometimes the texture was looking
freaky then in most cases with a purple touch.
Then I found somewhere the solution to create a new surf with alpha
intended to use GL_RGBA always. Next, SDL loads images exact the other way,
they would appear as texture rotated 180 degrees so you have to rotate them 180°.
I sayed this code might be not the best way but it's
enough for my case in oder to learn OpenGL :)
Perhaps this or the code might help you.
If others have filed a better solution please tell me!
good luck :)
More information about the SDL