Jump to content
  • Advertisement
Sign in to follow this  
relsoft

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

This topic is 4941 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!