Advertisement Jump to content


This topic is now archived and is closed to further replies.


OpenGl Lighting

This topic is 6850 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

Hey heres a very easy question to answer: With OpenGL Lighting I noticed that with positions, they have 4 values aka: GLfloat LightPosition[]= {0.0f, 0.0f, 2.0f, 1.0f}; What the hell is that last value about? The first three are obviously X, Y, Z coordinates. I heard that the last value is to define what type of light it is (Omni, Direct, etc). Is this true? If so what do the differing values stand for? Finally one last question: What routines/commands are used for using lights to projecting images? Thanks, Louden

Share this post

Link to post
Share on other sites
If you specify the light position, the 4th value is nothing more than the OpenGL w coordinate, a scaling coordinate. x, y and z are divided by w. Usually you set w to 1.0 if you don''t want scaling.

Visit our homepage:


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!