I have a problem which I cannot seem to solve. When I render my image, it should be smooth. However, I am getting a messy rendering which looks like there is some sort of grid ontop of it - as seen in the screenshot below.
glNormal, as glColor etc, must be called before its glVertex.
Otherwise, yes, it looks like you do not specify normals correctly, for some parts.
As a check, try setting always the same normal, for all vertices : you should ge a fairly uniform color. In that case, you only have aproblem with normals. Otherwise, something is wrong with vertices too.
Actually, it seems like my problems are coming from this line:
gluPerspective(45, 1, 0, 10);
If I comment out that line, I get a correct rendering!, but only with GL TRIANGLES, not GL POLYGON. I heard somewhere that polygon is not good for flat shading anyway.
Sorry to keep asking questions, but I’m still having problems with gluPerspective. Even at a value of 0.01 when I’m changing the values of gluLookat() I’m getting various bits of my image chopped off. It’s fine if I look head on, but to the side it’s not correct
if I comment out both glulookat and gluPerspective I get the image looking correct, but zoomed out quite far. The same angle, but zoomed in using glulookat and perspective seems to chop off half my image. I still see a red colour from the ambient lighting, but the shading goes completely
Thanks
edit - it seems as though the light is hitting the wrong side of my surface when using gluPerspective
Well you are doing wrong, but to help you more will be difficult without the complete code related to your transformations matrices, for both modelview and projection.