Lightning

Hi

I have a problem with lightning. I read the nehe tutorial7 but in this tutorial nehe uses textures but i only want a object with some colour. So i taked a square. I took the values for Ambient and Diffuse GLfloat followed
LightAmbient[]= { 1.0f, 0.0f, 0.0f, 1.0f};
GLfloat LightDiffuse[]= { 1.0f, 1.0f, 1.0f, 1.0f };

IMHO the object must be red. But my object is grey respectively black/white. So my questions must i use glColor3f with my object. I used it but the object always has the color black/white/grey. What made i wrong?

Thx
Florian Breier www.open-gl.de

Have you:

  • Specified a non-default normal and light direction/position?
  • Specified normals?
  • Set the material?
  • Or enabled color material?
  • Enabled ambient lighting?

Have a look at the following topics and you might solve it:

  • glNormal
  • glMaterial
  • glColorMaterial
  • glLightModel

PS: LIGHTING, keine Blitze!

Um, im not the best opengl person but here are my thoughts.

You should use glColor4fv() if you are passing arrays of 4 values.

Also try making the diffuse and ambient colors the same.

Don’t stand under any trees

Hmmm… if you use {0.0,0.0,1.0,1.0} as diffuse colour, do you get blue or pink objects?

[This message has been edited by Marc (edited 08-15-2000).]