View Full Version : Lightning

08-14-2000, 04:49 AM

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?

Florian Breier www.open-gl.de (http://www.open-gl.de)

08-14-2000, 05:02 AM
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! http://www.opengl.org/discussion_boards/ubb/wink.gif

08-14-2000, 06:14 AM
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.

08-14-2000, 09:41 AM
Don't stand under any trees http://www.opengl.org/discussion_boards/ubb/smile.gif

08-14-2000, 11:17 PM
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).]