absolute rotation

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);

		readpointer = first;
		while (readpointer != NULL)
		{
			glRotatef(readpointer-> angle, readpointer->xr, readpointer->yr, readpointer->zr);
			readpointer = readpointer->next;
		}

		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

I solved the problem. Here it is:

	glPushMatrix();
		if (!preview && angle > 0)    //preview = "TRUE" if mouse is moving (left button pressed)
		{
			glLoadIdentity();
			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…