Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: absolute rotation

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2004
    Posts
    8

    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:

    Code :
     
    	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:

    Code :
    	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

  2. #2
    Junior Member Newbie
    Join Date
    Jun 2004
    Posts
    8

    Re: absolute rotation

    I solved the problem. Here it is:

    Code :
    	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...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •