PDA

View Full Version : Lighting a quad



overloadnn
11-12-2000, 12:45 PM
I have a little problem when moving a light over a quad: It only gets lighted when the light is very close to the one of the vertexs. I do want smooth shades over the quad then light is on the top of it!!

I draw the quad with a texture (with just a color does the same) like this:

glPushMatrix;
Texture2.Enable;
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex2f(0,0);
glTexCoord2f(1, 0); glVertex2f(0,100);
glTexCoord2f(1, 1); glVertex2f(100,100);
glTexCoord2f(0, 1); glVertex2f(100,100);
glEnd;
glPopMatrix;

I tried applying glMaterial settings but nothing happens.
Any solution? Is this always like this?

Thanks a lot.

niko
11-12-2000, 10:34 PM
Yeah, that's how it goes. You just have to remember that because OpenGL uses gouraud shading, it can not render, for example, a complete, realistic, metallic specular highlight inside of just one triangle. You should subdivide your quad. Draw for example 9 or 27 quads to build one single big quad. This way the gouraud algorithm has more information to work on, resulting better quality. Ofcourse, the more you subdivide the better the result and the slower your application runs.

/n