kingslee
11th November 2006, 07:43
Hallo people,
I have a array list of an object and I showing it in a screen and rotating.
When I rotate it it goes wavery. some files work normaly.
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 );
}
but for some objects its working fine.
i dont know whats wrong in this.
I have a array list of an object and I showing it in a screen and rotating.
When I rotate it it goes wavery. some files work normaly.
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 );
}
but for some objects its working fine.
i dont know whats wrong in this.