View Full Version : Blending Woes...
MrShoe
05-04-2001, 09:43 PM
This is very funny in my opinion. I just made a program with a textured quad as a floor, and a sphere bouncing up and down on the floor. The sphere has a reflection which is done by just drawing another sphere under the floor and blending it with the floor using alpha blending. The program works perfectly. Except now i cant figure out how i set the alpha values. I change all the alpha values everywhere to 1 and I can still see the reflection. in glClearColor and glColor4f i changed the last value to 1.0 everywhere in the program, but the reflection remains. Help! I am confused.
well you dont need to change all the colours in the program as opengl is a state machine the current state is the one thats used.
ie u just need to change the previous colour to the sphere being drawn.
to not see the sphere reflection.
A/ dont draw it http://www.opengl.org/discussion_boards/ubb/smile.gif best method
Korval
05-04-2001, 11:21 PM
While zed's method certainly works, you might also want to guarentee that alpha blending is turned off by using glDisable(GL_BLEND).
MrShoe
05-05-2001, 12:29 AM
I know how to disable blending, but since i cannot change the alpha values i cant determine how reflective the surface is! Say i wanted the surface to be REALLY reflective id set the alpha value to 0.1, but this doesnt work...
merak
05-05-2001, 10:44 AM
what parameters do you have in glBlendFunc() ?
MrShoe
05-05-2001, 05:21 PM
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
Korval
05-05-2001, 05:23 PM
Well, that explains it then. The destination color (the floor) isn't effected by the alpha. Try glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
BTW http://www.opengl.org/discussion_boards/ubb/biggrin.gif if u wanna see a sphere bouncing up + down reflected in the floor check out the pong/breakout program on my site (url)
MrShoe
05-08-2001, 10:40 PM
Ha! I knew if was something REALLY obvious and stupid, thanks for the help!
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.