I create a 512x512 window and try to draw a simple square using the following function ::
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslatef(0.0, 0.0, 0.0);
glBegin(GL_QUADS);
glColor3f(1.0, 0.0, 0.0f); // glPointSize(1);
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(100.0, 0.0, 0.0);
glVertex3f(100.0, 100.0, 0.0);
glVertex3f(0.0, 100.0, 0.0);
glEnd();
glPopMatrix();
glutSwapBuffers();
}
And I expect to get a square of 100x100 in the left down corner of my window. But all I end up is a red square covering the upper right 256x256 corner of my window.
And I can’t figure out what my fault is !!
Also this is my init function, in case these calls might cause the problem.
void init(void)
{
// cout << "[init :: Running]" << endl;
// We enable the DEPTH BUFFER so we get our drawings to the right position in 3D space.
glEnable(GL_DEPTH_TEST);
glClearColor(grey, grey, grey, white); // Sets the window Color to the one chosen.
glShadeModel(GL_FLAT);
glMatrixMode(GL_PROJECTION); //
glLoadIdentity(); // Loads the Identity Matrix
glOrtho(0, width, 0, height, 0.0, -depth); // Sets our viewing to Orthographic.
}
If someone could give any idea, would be really gratefull !!