PDA

View Full Version : absolute rotation

BigRed
06-15-2004, 05:08 AM
Hello!

I´m new here and I hope y can find an answer for my cuestion here...

I want to rotate an object with my mouse. I use de Trackball Simulation.

My problem is that y want to make an absolute rotation that contains all my rotations that I´ve done since open the document.

Here is the source code which I´m using now:

glPushMatrix();

if (preview ) //preview is "TRUE" if you´re moving the mouse (left button pressed)
glRotatef(angle, xr, yr, zr);

while (readpointer != NULL)
{
}

glCallList(object);
glPopMatrix();

I have to use a list of all rotations that I´ve done since I opened the document. Bevore calling the object (with my object list) y do all these rotations. But that costs many time. That´s why I need another solution.

Here is one of my solutions that doesn´t work very well:

glPushMatrix();

if (preview)
glRotatef(angle, xr, yr, zr);
else
Rotate(angle, xr, yr, zr);

glMultMatrixf(m);

glCallList(object);
glPopMatrix();

I use MY function Rotate() to manipulate the ModelViewMatrix but that doesn´t work very well.

Thank you all... and greetings from Germany

BigRed
06-15-2004, 05:59 AM
I solved the problem. Here it is:

glPushMatrix();
if (!preview &amp;&amp; angle > 0) //preview = "TRUE" if mouse is moving (left button pressed)
{
glRotatef(angle, xr, yr, zr);
glMultMatrixf(ModelViewMatrix);
glGetFloatv(GL_MODELVIEW_MATRIX, ModelViewMatrix);
}
glPopMatrix();

glPushMatrix();

if (preview)
glRotatef(angle, xr, yr, zr);

glMultMatrixf(ModelViewMatrix);

glCallList(object);
glPopMatrix();

After open the document you hace to use

glGetFloatv(GL_MODELVIEW_MATRIX, ModelViewMatrix);
ONCE a time.

Thank you for watching and greetings from Germany...