PDA

View Full Version : How can i pan the model with my mouse in 3d



seadreamer
08-23-2004, 04:59 AM
In my project,the model is imported from a 3ds file and cosists of several indepent parts.Now i can select the different parts individualy by the mouse.But how can i pan them individualy by the mouse.

seadreamer
08-23-2004, 05:29 AM
btw,usually i resolve that problem as follow:
glMatrixMode(GL_PROJECTION)
glPushMatrix();
glLoadIdentity();
glOrtho(0,widow_width,0,widow_height);

glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glViewport(0,0,widow_width,widow_height);

glTranslatef(mouse.x,mouse.y,0.0);

drawmodel();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glMatrixMode(GL_PROJECTION)
glPopMatrix();

but the problem is the coordinats of my model
is too small to show them under this condition.

seadreamer
08-23-2004, 05:33 AM
oh,sorry,there is an error in this command:
glTranslatef(mouse.x,mouse.y,0.0);
should be:
glTranslatef(mouse.x,widow_height-mouse.y,0.0);

Tom Nuydens
08-23-2004, 05:56 AM
Moving this to the beginner's forum. If I understand your question correctly, all you need to do is divide your mouse offsets by some factor that places them more in line with the coordinates of your model.

-- Tom