PDA

View Full Version : Lighting



07-22-2001, 05:53 AM
.

07-22-2001, 05:56 AM
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?

harsman
07-22-2001, 06:19 AM
You need to send material properties for lighting to work, or enable color material. You also need to supply normals.

Rob The Bloke
07-22-2001, 06:20 AM
Is texturing Enabled? If so make sure you are using glTexEnvf(......,.....,GL_MODULATE);

Rob The Bloke
07-22-2001, 06:25 AM
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).]

07-22-2001, 06:43 AM
The GL_MODULTAE was the cause, I had specified GL_DECAL, thanks dude!

harsman
07-22-2001, 07:32 AM
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...

Rob The Bloke
07-22-2001, 02:41 PM
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