PDA

View Full Version : basic qt opengl problem



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.

kingslee
12th November 2006, 00:21
Is there anything wrong with my question or something unclear.

jacek
12th November 2006, 02:28
some files work normaly.
Then maybe the problem lies in those other files?

kingslee
12th November 2006, 06:35
Do you think the code can be used for any object array list?

I thaught the problem with the glrotate part , as its rotating in a circle.

jacek
12th November 2006, 16:26
Do you think the code can be used for any object array list?
What do you mean by "object array list"?

I don't see any problem why this code shouldn't work, provided that xRot, yRot and zRot variables have some normal values.