Sign in to follow this  

which blend function to use?

Recommended Posts

a 2D subwindow on top of a 3D subwindow.

I was using glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA), but I still couldn't remove the grey part. Thanks in advance.

PS. The top subwindow was texture mapped with alpha values. Texture Envi mode was GL_MODULATE. Blending was enabled during rendering.

[Edited by - griswald14 on December 5, 2010 5:38:46 AM]

Share this post

Link to post
Share on other sites
Yes, the image was uploaded as RGBA. It worked fine on other subwindows.

The following is what i have for the top subwindow, which is Subwindow5:

Subwindow5 = glutCreateSubWindow(Subwindow1, SubW1*5.0/6.0,SubH1/6.0,SubW1*5.0/6.0,SubH1*5.0/6.0);
StatsWindow = textureALPHA("subwindow5.raw",512,512,0,TRUE);

The display function:

void sub5Display (void)
SetBackground (W5_width, W5_height, StatsWindow);

Setbackground just make a polygon of W5_width X W5_height, and texture StatsWindow on it. Also, I rendered sub window 5 last.

The grey part is Alpha = 0, am i missing glColor4 or glClearColor?

Thanks again

Share this post

Link to post
Share on other sites
I think you might be getting foiled by glut here. I'm not sure if glut subwindows will allow blending in between them like that, but I don't use it so I couldn't say.

Try setting the clear color to (x,x,x,0) before you glClear the subwindow, see if that works.

Share this post

Link to post
Share on other sites
Why are you having a second window anyway. It has to have its own GL context and frame-buffer. Seems like a waste. You can always just draw in orthographic mode for 2D stuff.

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