Jump to content
  • Advertisement
Sign in to follow this  

OpenGL basic lighting question

This topic is 3712 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

im relitively new to opengl and im pretty much learning opengl by building my own engine and then adding to it as i go along, ive made some progres (i think :p) but now im stuck on getting even the most basic lighting to work here are some screenshots of what i have so far, its just a testing application that uses my engine and adds some models to it (the models are very simple objects that i typed out in notepad) the aplication then allows me to move thourgh the scene using my keybord http://img211.imageshack.us/img211/3626/97823943bu9.jpg http://img514.imageshack.us/img514/862/51418334kc8.jpg http://img175.imageshack.us/img175/1985/47667309sh0.jpg http://img186.imageshack.us/img186/3341/64205685kj3.jpg ok now for lighting ive googled up numorous tutorials on lighting and they all say pretty much the same thing but now matter what ive tried so far my lighting is always messed up. i have added 1 stationary light source with a weak ambiant light and a strong difusal light but when my models or my camera rotates or translates around the the way the light affects the surfaces becomes wrong apart from that all surfaces that doesnt have a texture mapped to it becomes grayscale, some tutorial said that i should disable lighting when i want to preserve the color of such a surface but thats kinda defeating the purpose isnt it and the other problem is that i cant seem to move the light source around. here are some screenshots of the same testing aplication this time with lighting enabled http://img119.imageshack.us/img119/3176/0liw9.jpg http://img127.imageshack.us/img127/719/1lqc9.jpg

Share this post

Link to post
Share on other sites
A/ check the faq's at www.opengl.org
B/ is that a point light?
C/ see if your normals are correct
perhaps use
glBegin( GL_LINES );
for ( i=0; i<all_vertices_in_scene; i++ )
glVertex3fv( vertex );
glVertex3fv( vertex + normal*10 );

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!