i’m a newbie in Opengl and i have a doubt in blending. please tell if the procedure i follow is correct for blending. first i draw all the opaque objects and then in the last i draw the object to be transparent. I’m using GLUI for interface. so i have to check the state of the checkbox and enable and disable the blending. hence just before draw the transparent object (and after drawing the opaque objects), i check the state of the checkbox and enable blending.
now heres the problem, in the output, i see a additional black inner object(the one which is opaque).this black object is stationary.so when i rotate the object when in blend mode, the black object interferes with the rotating opaque object.
I hope you understand what i mean. i think there must be something wrong in specifying the source and destination factors in glBlendFunc(). please tell me the error.
actually, i kept the alpha value 0.5 to make the object appear transparent.
as for the black object, i tried glDepthMask(GL_TRUE) and it worked. the wierd black object just disappered. but how is this possible?
i just don’t understand. the glDepthMask() must be set to false so that the buffer is read only when rendering transparent objects. but if i keep it to false, i get that misterious black inner object(which is duplicate of the lit inner object). I just tried and kepth the glDepthMask to true and it worked out perfectly.
i forgot to ask you something in the earlier post. what is subtractive and additive transparency? also is there some good resource on the net on blending? i’m particularly confused on how the source and destination factors in glBlendFunc() work.
in general, everything is right. if you first draw all solid faces with blending disablend and after that draw all transparent faces in back-to-front order with blending enabled, it should look fine. the black stuff rather looks like a culling problem.