I have this program which draws cube on the boundary of the defined ortho. I see that the line on the left and top are missing. What could be the problem? The code snippet is pasted below:
#include <GL/glut.h>
void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_FLAT);
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity (); /* clear the matrix */
glBegin( GL_LINE_LOOP );
glColor4f (1.0, 0.0, 0.0,1.0);
glVertex2f( -1.0f, -1.0f);
glVertex2f( -1.0f, 1.0f);
glVertex2f( 1.0f,1.0f);
glVertex2f( 1.0f, -1.0f);
glEnd( );
glFlush ();
}
void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glOrtho (-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (500, 500);
glutInitWindowPosition (100, 100);
glutCreateWindow (argv[0]);
init ();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;
}