void GLWidget::paintGL()
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glPushMatrix();
glTranslatef(0.0, 0.0, -10.0);
glRotatef(xRot/16, 1.0, 0.0, 0.0);
glRotatef(yRot/16, 0.0, 1.0, 0.0);
glRotatef(zRot/16, 0.0, 0.0, 1.0);
glCallList(1); // call display list
glPopMatrix();
}
void GLWidget::resizeGL(int width, int height)
{
GLfloat w = (float) width / (float) height;
GLfloat h = 1.0;
glViewport( 0, 0, width, height );
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-w, w, -h, h, 5.0, 60.0);
//glOrtho(-1.5, +1.5, +1.5, -1.5, 4.0, 15.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef( 0.0, 0.0, -10.0 );
}
void GLWidget::paintGL()
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glPushMatrix();
glTranslatef(0.0, 0.0, -10.0);
glRotatef(xRot/16, 1.0, 0.0, 0.0);
glRotatef(yRot/16, 0.0, 1.0, 0.0);
glRotatef(zRot/16, 0.0, 0.0, 1.0);
glCallList(1); // call display list
glPopMatrix();
}
void GLWidget::resizeGL(int width, int height)
{
GLfloat w = (float) width / (float) height;
GLfloat h = 1.0;
glViewport( 0, 0, width, height );
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-w, w, -h, h, 5.0, 60.0);
//glOrtho(-1.5, +1.5, +1.5, -1.5, 4.0, 15.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef( 0.0, 0.0, -10.0 );
}
To copy to clipboard, switch view to plain text mode
Bookmarks