PDA

View Full Version : glBlendFunc help please....



Al Grant
05-17-2006, 03:54 PM
Hi guys,

I am trying to use a white and black image to make a cookie cutter type
effect - where white is clear and black is black.


I am using glBlendFunc with Gl_DST_COLOR and GL_ZERO.


My two images are at homepages.ihug.co.nz/~acgrant/mask.bmp and
homepages.ihug.co.nz/~acgrant/Untitled-1.bmp


My code is at :
http://www.gamedev.net/community/forums/topic.asp?topic_id=393462


But for some reason I am getting a blank window.


Both images draw fine on their own.


Can anyone PLEASE help?


Thanks


-Al

PS: I am in VC++ Express.

sqrt[-1]
05-17-2006, 07:26 PM
Add a glDisable(GL_BLEND); to the end of your DrawGLScene.

What is happening is that it works correctly the first frame, but each frame onwards still has blending enabled so it gets progressively darker each render until it goes black.

It is typical for an app to designate a "known" OpenGL starting state. So you typically you disable anything that you enable. (or enable anything you disable) that is different from your "default" state.

Al Grant
05-17-2006, 09:29 PM
sqrt[-1] you are a genius. That fixed it. I had a bunch of people look at that code and couldnt see what was wrong so congrats to you and THANKS.

-Al