Jump to content
  • Advertisement


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


Matrix Transforms and Lighting

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

Hello all, I posted here last week with a problem with OpenGL lighting - and I''ve since worked it out. However, the solution really doesn''t look pretty... and more importantly, whilst it technically works I doubt its ''correct'' OpenGL. Any chance anyone can tell me how this should be done? Basically, I have a load of geometry being rendered with a single directional light source. Yet I found that changing the viewing angle (not position tho) would affect lighting. So instead of setting up lighting ONCE at startup (as I would in D3D) I have to re-set the direction before rendering each block of terrain (such that the current MODELVIEW transform doesn''t screw it over). As such I''ve lost 10 million triangles/second in performance (~50mil down to 38-40mil). I cant see how this can be correct?! Surely the many OpenGL games kicking around can''t be doing something as ugly as this! surely there is a way that I can setup my lighting and then leave it alone ? or at least only make minimal changes such that the MODELVIEW doesn''t screw over my lighting? cheers, Jack

Share this post

Link to post
Share on other sites
is the following construct more correct ? (haven't checked it yet..)

glPushMatrix( )
glLoadIdentity( )
//set light position
glPopMatrix( )

as a do-once-at-startup type operation?

EDIT: scrap that, it dont work - anyone got ANY ideas?!


[edited by - Jollyjeffers on March 21, 2004 10:45:33 AM]

Share this post

Link to post
Share on other sites

  • 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!