Sign in to follow this  

Forcing RGBA instead of RGB when loading images as SDL surfaces in OpenGL

This topic is 4660 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys, I want to use GL_RGBA instead of GL_RGB for transparencies. How would I do that? I am currently using the blending method from Nehe's tutes but sometines the blending does not go well with the terrain. Here's an example file with source: Needs SDL.DLL http://rel.betterwebber.com/junk.php?id=38 Controls are MOUSE, WASD and the mouse buttons. Thanks in advance!!!

Share this post


Link to post
Share on other sites
I have a function which calls SDL_CreateRGBSurface with the appropriate masks (1 byte for R,G,B, and A), then I use SDL_BlitSurface to copy from the RGB surface onto the RGBA one. That gives you a target for glTexImage2D, and then you can free both SDL_surfaces.

Share this post


Link to post
Share on other sites

This topic is 4660 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this