[Plib-devel] ssgSimpleState Question (bug?)
Brought to you by:
sjbaker
From: Curtis L. O. <cu...@me...> - 2000-05-15 18:10:46
|
Steve, For my flight gear application I had been noticing some strange lighting effects where the entire scene would jump to a noticably (and erroneously) brighter state depending on view direction, pitching the nose of the plane up, pitching down, etc. Strange. Today I was looking a bit closer at what was going on, and it turns out that this effect happens whenever my moon is visible in the view frustum. (i.e. not being culled.) In otherwords, whenever the moon gets drawn, my scene gets erroneously brighter. Looking a bit closer, it appears to be related to how I've set up the ssgSimpleState for my moon. Here is the code: orb_state = new ssgSimpleState(); orb_state->setTexture( (char *)path.c_str() ); orb_state->setShadeModel( GL_SMOOTH ); orb_state->enable( GL_LIGHTING ); orb_state->enable( GL_CULL_FACE ); orb_state->enable( GL_TEXTURE_2D ); orb_state->enable( GL_COLOR_MATERIAL ); orb_state->setColourMaterial( GL_DIFFUSE ); orb_state->setMaterial( GL_AMBIENT, 0.0, 0.0, 0.0, 1.0 ); orb_state->setMaterial( GL_SPECULAR, 0.0, 0.0, 0.0, 1.0 ); orb_state->enable( GL_BLEND ); orb_state->enable( GL_ALPHA_TEST ); orb_state->setAlphaClamp( 0.01 ); Now if I have the following setMaterial() line commented out, this weird/erroneous effect goes away (but then my moon isn't drawn correctly) // orb_state->setMaterial( GL_AMBIENT, 0.0, 0.0, 0.0, 1.0 ); Notice that I enable(GL_COLOR_MATERIAL), and then setColourMaterial(GL_DIFFUSE). I want the ambient component locked to black so I can make my dark side of the moon blending work correctly. Am I making sense? I realize there is undefined weirdness in the opengl spec when you mix setColorMaterial() and setMaterial() ... we've been through that enough times. plib doesn't seem to like it when some of my simple states use enable(GL_COLOR_MATERIAL) and some don't so I had been standardizing on using GL_COLOR_MATERIAL. But, in plib I can't seem to correctly enable(GL_COLOR_MATERIAL) just for the DIFFUSE component, and set the ambient component to something else. Am I missing something here as to proper usage of plib simple states? Is there some standard way to accomplish what I want to do in plib? Thanks, Curt. -- Curtis Olson Human Factors Research Lab Flight Gear Project Twin Cities cu...@hf... cu...@fl... Minnesota http://www.menet.umn.edu/~curt http://www.flightgear.org |