Jump to content
  • Advertisement
Sign in to follow this  
griswald14

which blend function to use?

This topic is 2781 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

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

http://img576.imageshack.us/img576/70/asdfas.jpg

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
Advertisement
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);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_ALPHA );
glutDisplayFunc(sub5Display);
glutReshapeFunc(reshape5);
StatsWindow = textureALPHA("subwindow5.raw",512,512,0,TRUE);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glutMainLoop();

------------------------------------------------------------------
The display function:

void sub5Display (void)
{
glClear(GL_COLOR_BUFFER_BIT );
glEnable(GL_BLEND);
SetBackground (W5_width, W5_height, StatsWindow);
glDisable(GL_BLEND);
glutSwapBuffers();
}

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
Yes, I can process my game without that sub window. I got the result I wanted using Orthographic Render like dpadam450 suggested. Thanks man. 0/

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!