Lighting

.

I guess something must be wrong with the OpenGL lighting facility that I got, shouldn’t the screen turn pitchdark when I enable lightin, but without any lights?
Besides, whenever I set up some lights I still don’t get any changes, the scene remains the same es without enabling lighting. Anyone knows how come?

You need to send material properties for lighting to work, or enable color material. You also need to supply normals.

Is texturing Enabled? If so make sure you are using glTexEnvf(…,…,GL_MODULATE);

Originally posted by harsman:
You need to send material properties for lighting to work, or enable color material.

You dont ‘Need’ to specify these, OpenGL does have defaults if these aren’t specified. to get a light up and running (albeit one with the defaults) you just need to put :

glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);

as long as your normals are specified at the vertices, there shouldnt be a problem. Try reducing it to the minimum lighting requirements and add stuff in.

The only other thought is, have you speciied the ambient or emmisive properties at a high value such as 1? doing so will prevent lighting from having an effect…

[This message has been edited by Rob The Bloke (edited 07-22-2001).]

The GL_MODULTAE was the cause, I had specified GL_DECAL, thanks dude!

Well, ok, you don’t need to specify them, but things are really dark with the default values if you use say LIGHT1 instead of 0, so you might miss that your objects are lit. Especially if your display isn’t gamma corrected. Hey, it happened to me when I was starting out, that’s why I mentioend it. But my post was unclear, I should have worded it differently. Especially considering he said, his view wasn’t pitch black. I need to read stuff more carefully before I post…

Its only GL_LIGHT0 that has some default values, any other lights have 0 for all components. If GL_LIGHT1 was enabled, the only lighting you’d see would be the default scene ambient lighting. This has an ambient value of 0.3,0.3,0.3 I believe… just a bit of helpful info