Skip to main content
gamedev.net
🔒 Locked

Lighting problem ( beginner question )

Started by Zab 2 replies 300+ views
Original Post
Zab
Zab
Hi I''m having a problem with the lighting in my program. I''m using a half intensity ambient light and full intensity diffuse light: GLfloat light_pos[] = { 0, 30, 0, 0 }; GLfloat white_light[] = { 1, 1, 1, 1 }; GLfloat half_light[] = { 0.5 , 0.5, 0.5, 0.5 }; glLightfv( GL_LIGHT0, GL_POSITION, light_pos ); glLightfv( GL_LIGHT0, GL_AMBIENT, half_light ); glLightfv( GL_LIGHT0, GL_DIFFUSE, white_light ); glEnable( GL_LIGHTING ); glEnable( GL_LIGHT0 ); And I''m drawing a large quad like this ( flat on the zy plane ): glBegin( GL_QUADS ); GLfloat material[] = { 0.3f , 0.3f , 0.0f ,0.1f }; glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, material ); glNormal3f( 0.0f, 1.0f, 0.0f ); glVertex3f( m_b1.x, m_b1.y, m_b1.z ); glVertex3f( m_b2.x, m_b2.y, m_b2.z ); glVertex3f( m_b3.x, m_b3.y, m_b3.z ); glVertex3f( m_b4.x, m_b4.y, m_b4.z ); glEnd(); I have prevously rotated the model view matrix in order to simulate camera movement.... The problem is that the color the quad is being drawn at get darker as the angle between the quad surface and the direction the ''camera'' is pointing approaches 90 degees ( where the camera is pointing directly at the quad surface ) Any ideas? The light is only set up at the beginning of the program, is this correct? ( Changing the alpha components doesn''t help anything by the way ). Any and all comments much appreciated! Zab.
zedzeek
zedzeek
>>he light is only set up at the beginning of the program, is this correct?<<

no see the faq (section lighting) at www.opengl.org

http://uk.geocities.com/sloppyturds/gotterdammerung.html
zedzeek
zedzeek
>>he light is only set up at the beginning of the program, is this correct?<<

no see the faq (section lighting) at www.opengl.org

http://uk.geocities.com/sloppyturds/gotterdammerung.html
Zab
Zab
Quick question, quick reply, quick fix. Couldn''t be happier!

Thank you very much!

Zab.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.