Sign in to follow this  
SigmaX

[SDL] transparency with OpenGL

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
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

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