PDA

View Full Version : Light a beizer grid



McZ
12-07-2000, 01:43 AM
I have made a simpe 4 point controlled beizer grid.. I think they are called so. anyway it is a grid from the base and controll points so I can make it curved smoothly.

I have filled the grid with red color. and it looks great http://www.opengl.org/discussion_boards/ubb/smile.gif but when I set up a light the grid is white.. but only when I use 'auto normalize'. when I turn it of it looks like the light isnīt there..

and one thing I verry new in OpenGL programming.. I started with my first rotating cube for about 4 weeks agoo, so I havenīt done any lightning at all so everything might be wrong.

tdavie
12-07-2000, 02:45 AM
You may be having problems with your material setup. When you start doing lighting, the normal glColor3f commands stop working, instead you need to specify material propertys, e.g. colour, alpha, shineness, reflectiveness...... There is however a way round it, what you need to do is specify the current material in such a way that it tracks the current colour, I can't remember the command at the moment, but I know it is somewhere in the lighting section of the Red Book.

Deiussum
12-07-2000, 04:23 AM
When you say you are using "auto normalize" do you mean you are enabling GL_AUTO_NORMAL, or GL_NORMALIZE? They are two different things. The first is what you want to generate normals for the glMap* functions.

McZ
12-08-2000, 12:02 AM
I use GL_AUTO_NORMAL but I have tried GL_NORMILIZE to when GL_AUTO_NORMAL is on the color is white and no shadows or anything, and when I turn GL_NORMILIZE on it is red like the lights never turned on.

Deiussum
12-08-2000, 05:49 AM
As tdavie said, you need to set the material properties rather than using the glColor* functions when you enable lighting. Not sure why using GL_NORMALIZE would change your object from white to red, That basically just forces normals to a length of 1 after transformations, I think. I would think that if you aren't using a material your surface would be a blended gray, which is what the default material color is.

robert
12-08-2000, 06:45 PM
I think it is something like glEnable(GL_COLOR_TRACK) or something like that.