GL_LINES with lighting enabled

I’m rendering a scene containing several lines. With lighting disabled everything renders fine using calls to glColor for the line coloring.

The problem comes when I enable lighting and call glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE). As I rotate the model (or the light) the lines intensity changes. Expected behavior but I want the lines to render with consistent intensity all around. Anyone know of a descent solution to keep GL_LINES intensity constant with lighting enabled?

Why not just disable lighting when you draw the lines?

I am not trying to be unhelpful btw… But what you describe wanting… “constant intensity” is best achieved when you don’t light an object.

Other than that you are going to get some effect, or have to do some fiddling with material properties, which frankly seems a bit of a waste of time…

Perhaps I didn’t understand what you want. :slight_smile:

Doh! Because I’m a idiot. I made the assumption that lights were either on or off and I wanted to mix surfaces with my lines. But that assumption was wrong. I just tested it and if I disable lighting when I render lines, and re-enable to render surfaces things work perfect. Appreciate your response, because it would have taken me a lot longer to figure that out without it.

Glad it solved it for you. And btw, if I had a penny for every time I’ve missed something obvious, well… I’d have a very big pile of pennies! That’s all I am saying! :slight_smile: