Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

OpenGL: Fixing Dull Looking Objects

📅 2010-Jul-15 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ lighting, opengl ⬩ 📚 Archive

Do your objects look dull or dark when they are turned around? Then, maybe you have missed out on updating the light position.

The light position can be updated by using the glLight() OpenGL calls:

glLightfv( GL_LIGHT0, GL_POSITION, lightPos );

Typically, the light position can be set to the same as the eye position, that is updated to the gluLookAt() call to setup the camera.

© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘📧