# Smooth Rotation of large triangle mesh

Hello,

I’ve written a program that loads wavefront files to perform some manipulations on a triangle mesh with roughly 50k triangles.

The problem i am having is that when i rotate about the Y and Z axis the rotation jitters like a slideshow, when i rotate around the X axis it is very smooth.

My question is this: Is there any article or method to achieve a smoothe rotation?

Thank you.

Maybe looking at a previous post will help – see post #261909 and the replies about using dt to scale time.

Or maybe that is irrelevant. It is hard to say without a snippet of code. Can you show the relevant display() code?

Make sure you’re not doing something silly like axis == Y || axis == Z ? WobbleHorribly() : RotateSmoothly();

Go ahead and laugh but I’ve done things like that before.

I first pick up the events that give me X and Y coordinates on mousedown on the screen and depending on the direction the mouse is moving (using mouse move event) set the relevant rotX, rotY to rotate by 2 in that direction. Then after in the draw function i set rotX Y and Z to 0 so it doesnt continue to rotate if the mouse button is left down.

As for rotZ uses the X coordinate but only when the middle mouse is down.

``````
void __fastcall TmainForm::drawMesh()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

if(currmesh!=0)
{
glTranslatef(0,0,zoom);

if(b_GUIMouseDown)
{
glRotatef(rotX, 1, 0, 0);
glRotatef(rotY, 0, 1, 0);
glRotatef(rotZ, 0, 0, 1);

rotX=rotY=rotZ=0;
}

// after this i call the draw class which just draws the triangle
// mesh on the screen at this location
...
}

``````

What i find strange is why its smooth on one of the axis and jittery on the other two.

Hi,

Thanks for all your posts after taking a look at the recommended reading by marshats i went throught my code and found that i call the draw function for certain transformations in this class so when i try to rotate im drawing mutiple times. Now its smooth. I missed this because there is a large amount of code and it takes a while to go through.

Thank you again.