Jump to content
  • Advertisement
Sign in to follow this  
SigmaX

[SDL] transparency with OpenGL

This topic is 4481 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, I've started playing with SDL and openGL together and I've run into a problem with transparency. Currently I'm at the point where I have openGL graphics being rendered behind some SDL BMPs. What I wanted to do was make the BMPs have transparent elements so you could see the openGL behind them, but when I do the nomral SDL transparency stuff it just makes a black hole instead of a trasnparent one. Is there anything special I need to be setting in order to get the SDL graphics to be transparent? Does anyone know of any tutorials on using SDL and openGL together? I would have posted some code but I'm not sure what is relevent in this case, so if you want to see anything let me know. Thanks [Edited by - SigmaX on March 13, 2006 2:22:55 PM]

Share this post


Link to post
Share on other sites
Advertisement
Typically you use SDL and OGL in this way: SDL creates window, handles input etc. and OGL is responsible for rendering. So, you shouldn't do anything like render some bitmaps with SDL, and other with OGL. That's a no no no :-)

Instead, you should load all your pictures and convert them to OGL textures, and render them on screen with orthographic projection set, as a quad with texture applied. Then you can easily take advantage of alpha blending (glEnable(GL_BLEND) etc.) - simply set some pixel's alpha value to 0 and it won't be rendered.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!