PDA

View Full Version : TRANSPARENCY AND MOUSE CONTROL PROBLEMS



jjcheng
06-29-2005, 10:55 AM
I am trying to make an object transparent, though I don't really know what to do here. Someone mentioned to me about the alpha level, but I don't know what the standard variable for that is, or where to look on the program I am modifying.

Also, I was responsible for making the mouse useable on a program that was originally all controlled through the keyboard. The program is for viewing 3D objects. Basically, when the user clicks on the object, he can rotate it. For some reason, the mouse controls act differently with different 3D objects I view with the program. I don't understand why.

06-29-2005, 03:44 PM
I am trying to make an object transparent, though I don't really know what to do here.have you read the redbook?

susu
06-29-2005, 06:14 PM
i think the transparent object can be realized by modifying the transparency of the texture of every faces.

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=08

Maybe it can resolve your puzzle.

José Gerardo Palma Durán
06-29-2005, 09:16 PM
I enable blending, and with a texture with alpha channel, y use the next blend function

glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

jjcheng
06-30-2005, 11:02 AM
I also put this in the init function.

glColor4ub((GLubyte)(1.0),(GLubyte)(1.0),(GLubyte) (1.0),(GLubyte)(0.5));
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

The original code used glColor3ub, I changed it to 4ub, and gave it an alpha value of 0.5.

After that, I also added this code below it:

glEnable(GL_BLEND);
glDisable(GL_DEPTH_TEST);

Though, there isn't any change. What am I doing wrong?

06-30-2005, 08:27 PM
glColor4ub((GLubyte)(1.0),(GLubyte)(1.0),(GLubyte) (1.0),(GLubyte)(0.5));this function takes unsigned bytes [0,255]. you are passing floats.

try glColor4ub(255,255,255,128);

only the floating point flavors take the normalized color components...

jjcheng
07-01-2005, 11:28 AM
Ah I see. Thanks for the help!