Materials and lighting
I finally enabled GL_Lighting in my program, but now everything is rendered dark gray, haha.
Anyway I first call this:
glEnable( GL_LIGHTING );
GLfloat lmodel_ambient[] = {0.2f, 0.2f, 0.2f, 1.0f}; // Set some ambient light for our scene
glLightModelfv( GL_LIGHT_MODEL_AMBIENT, lmodel_ambient );
Then I set each vertex up with a material that contains a diffuse color.
Buuuuut it still draws gray. So. Doesn''t glLightModelfv set the ambient light? Or do I need to use up one of the 8 dynamic lights for this.
Ok so the default ambient light does *use up* one of the 8. I was thinking maybe there was background lighting that acted like a '9th' light.
So if glLightModelfv uses light 0, why have it at all?
Also, does anyone know how big a performance hit it is to turn the lighting off and on? I am thinking I will need to disable it when I draw my interface (text over the top of the rendered image, drawn in ortho mode), but I hate to have to switch it off and on every frame unless its fast to do so.
Any other way to make the interface look right? Thanks again!
[edited by - aargyle on April 29, 2003 7:24:34 AM]
So if glLightModelfv uses light 0, why have it at all?
Also, does anyone know how big a performance hit it is to turn the lighting off and on? I am thinking I will need to disable it when I draw my interface (text over the top of the rendered image, drawn in ortho mode), but I hate to have to switch it off and on every frame unless its fast to do so.
Any other way to make the interface look right? Thanks again!
[edited by - aargyle on April 29, 2003 7:24:34 AM]
You don''t have to disable lighting - just adjust the material properties of your quad (or whatever you''re using to draw your interface) so that it''s ambient value is full - it should then be drawn at full brightness whatever the lighting...
...I think
Get hold of a copy of the red book!
...I think
Get hold of a copy of the red book!
>>Ok so the default ambient light does *use up* one of the 8. I was thinking maybe there was background lighting that acted like a ''9th'' light.<<
there is also a global ambient light parameter (check red book)
>>Also, does anyone know how big a performance hit it is to turn the lighting off and on? I am thinking I will need to disable it when I draw my interface (text over the top of the rendered image, drawn in ortho mode), but I hate to have to switch it off and on every frame unless its fast to do so.
<<
once a frame will not affect performance in any way
http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html
there is also a global ambient light parameter (check red book)
>>Also, does anyone know how big a performance hit it is to turn the lighting off and on? I am thinking I will need to disable it when I draw my interface (text over the top of the rendered image, drawn in ortho mode), but I hate to have to switch it off and on every frame unless its fast to do so.
<<
once a frame will not affect performance in any way
http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html
I did check the red book, thats where I got the code above. They enable LIGHT_0 as well, I was just confused by the set abient light call.
IS there a ''9th'' ambient light that I can access?
IS there a ''9th'' ambient light that I can access?
don t you have to set the 4th variable of your position to 0 in order to get ambience light or environment light...?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement