Hi guys!
In my code, I’m using glOrtho and it doesn’t make result. If I compile without glOrtho, it’s the same.
This is my code:
void GLWidget::initializeGL()
{
glClearColor(1,0,1,1);
}
void GLWidget::paintGL()
{
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
glBegin ( GL_QUADS );
glColor3f(1,0,0);
glVertex2f ( 0.0 , 0.0 );
glVertex2f ( 0.5 , 0.0 );
glVertex2f ( 0.5 , 0.5 );
glVertex2f ( 0.0 , 0.5 );
glEnd();
}
void GLWidget::resizeGL(int width,int height)
{
glViewport(0,0,width,height);
const register double Left = (double)width*10/(double)height;
glMatrixMode ( GL_PROJECTION );
glLoadIdentity();
glOrtho ( Left , Left , 10.0 , 10.0 , -1.0 , 1.0 );
glMatrixMode ( GL_MODELVIEW );
glLoadIdentity();
}
Does anybody know why it doesn’t work?