PDA

View Full Version : GL_LINES with lighting enabled



cprimenull
06-18-2009, 11:34 AM
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?

scratt
06-18-2009, 12:16 PM
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. :)

cprimenull
06-18-2009, 12:37 PM
Why not just disable lighting when you draw the lines?

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.

scratt
06-18-2009, 06:53 PM
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! :)