Archived

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

Whim

How can I do lighting properly?

Recommended Posts

Wow! Im glad i found NeHe''s site and forum. Lots of helpful stuff appears here. Recently, I started a small GL app (using GLUT, not the windows API), and was frustrated to find that despite following (to my knowledge) the red book and other working examples, I cannot seem to get a large grey slab to be lit properly (I''m aiming for a "table" look). When I sent it to my friend, he said it worked fine, though ... and the odd thing is that we have the same video card. I''ve tried using two different drivers for my voodoo3 (the ones from teh 3dfx site, and then also the older ones from GLSetup), and the block still appears to be solid shaded, in that I cannot see any edges that are internal to the silhouette. Can anyone suggest what I might do to remedy this situation, or more accurately diagnose the problem? Thanks in advance o.O (Confused programmer )

Share this post


Link to post
Share on other sites
I wanted to suggest three things. First off, are you sure you set the shade model to smooth or gourad? If it''s set to flat (default) then the anomaly you''re experiencing is supposed to happen. Second, you should try winding techniques. By default, the front of a polygon is facing you (or out) if you set the vertices in a counter-clockwise motion. If you made them all in a clockwise motion, you can change that by setting the gl command for culling to GL_CW instead of GL_CCW (default for counter-clockwise). And Last, you should calculate normals for your ploygons, that is how to make sure OpenGL nkows how to handle lighting from the 90 degree angle of the polygon face.

-- John d8?)

"No, really, I DO know it all!" <-- Yeah, Right!!

Share this post


Link to post
Share on other sites