View Full Version : Do normals affect lines?
James W. Walker
07-09-2005, 10:41 PM
Suppose you draw some lines using glBegin(GL_LINES). Does glNormal affect them? I wouldn't think that it would make sense for a line to have a normal, but it looks like lines are being affected by lighting in some way that doesn't look natural.
Hmm, I'm not sure. But if that's your problem you could push the lighting attributes, turn off the lights, draw your lines and then turn the lights back on and pop the attributes.
07-10-2005, 03:14 AM
Of course lines can have a "normal" : in reality the normal you specify is not an actual normal (even on a triangle, you can specify whatever normal you want at each vertex).
This normal is only used to compute lighting. That can be useful when modelling, all graphic packages such as 3dsmax, Maya, etc have a "lit wireframe" mode. On a high resolution mesh you get a much better understanding of the actual volume when it is lit, with the wireframe benefit to be able to see through.
James W. Walker
07-10-2005, 08:33 AM
I can understand that if you're drawing a wireframe model, so that each line is actually an edge of a face, then it would make sense to light the edge using the normal of the face. But if a line is just a line, then it's really artificial to assign it one of the infinitely many possible normals.
Turning off lighting isn't what I had in mind either. The idea of Lambert illumination shading is that you attenuate the light according to the angle between the light ray and the surface. There is a well-defined angle between a light ray and a line segment to be drawn. But I guess OpenGL doesn't do this.
Does glNormal affect them?Yes. As ZbufferR said per vertex normals are arbitrary in opengl. This is very good becuase you can send average normals for a mesh to get smooth lighting among other things... very flexible.
I think the only difference in lighting line segments is that opengl always uses the front color/material, since it can only determine the orientation of polygons. Otherwise I think line segment lighting is identical to faces. It's just some more vertices to opengl, the primitive is largely irrelevant.
There's more on page 63 of the 2.0 spec.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.