Here is my resize window function:
Code: Select all
void GLWidget::resizeGL(int width, int height) {
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glViewport( 0, 0, width, height );
glOrtho( 0.0, width, height, 0.0, -1.0, 1.0 );
//Initialize modelview matrix
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
}
Code: Select all
void GLWidget::paintGL() {
glClear(GL_COLOR_BUFFER_BIT);
glBindTexture( GL_TEXTURE_2D, imageID );
glBegin( GL_QUADS );
glTexCoord2f( 0.0, 1.0 ); glVertex3f( 0.0, 0.0, 0.0 );
glTexCoord2f( 32.0 / 128.0, 1.0 ); glVertex3f( 32.0, 0.0, 0.0 );
glTexCoord2f( 0.0, 32.0 / 64.0 ); glVertex3f( 32.0, 32.0, 0.0 );
glTexCoord2f( 32.0 / 128.0, 32.0 / 64.0 ); glVertex3f( 0.0, 32.0, 0.0 );
glEnd();
}