I had some problems with Drawing rectangles in OpenGL.
When I define a Perspective Projection-Matrix and set the PolygonMode to GL_LINE and rotate the rectangle around the y-axis then sometimes in some special positions the Lines who create the Rectangles disappears partial. What can be the reason for this strange phenomena.
Here is the Projection and Rendering-Code is use for the above described example:
GLfloat fAspect = (GLfloat) w/(GLfloat) h;
glViewport( 0, 0, (GLsizei) w, (GLsizei) h);
double angle = calculateAngle(h, 40);
gluPerspective(angle, fAspect, 5.0f, 400);
gluLookAt(2.0, 1.0, 3.0, // eye
0.0, 5.0, -1.0, // center
0.0, 0.0, 1.0);// dir.vector
glRectd(-5 ,-5, 5, 5);
glRotatef(0.3f, 0.0, 1.0, 0.0);
I hope somebody can tell me the reason for that.
Yes, like wikidsmot showed. The problem is that your near clip plane is too far away. If you need that near clip plane to be that far away, then you would need to translate your whole scene farther out down the -z axis.