PDA

View Full Version : movement of one object



Claudio
07-09-2000, 10:31 PM
I for now use gltransfer and gl rotate befor draw and object to move and rotate it.
If i have two object also second object are rotated and translated.
Ho can i set up matrix for move only current drawing object?

Thanks

Relic
07-09-2000, 11:04 PM
One method would be to use glPushMatrix and glPopMatrix around calls you use to manipulate and draw the specific object.

Claudio
07-09-2000, 11:10 PM
I have used it but the result is tath all object are stopped.....

Relic
07-09-2000, 11:49 PM
Maybe I misunderstood your question. You have to redraw the whole scene and each object has it's own matrix which can easily be separated by something like this:

// for each object
glPushMatrix();
glTranslate
glRotate
glBegin
...
glEnd
glPopMatrix();
// next object
SwapBuffers();

That should work.

Claudio
07-10-2000, 12:06 AM
Yes it is the code, bu te swap is done when all object ar drawn.
I can also use my function to mnipulate internal matrix and the put it into opengl framework, but it must work also with gltransfer etc.

Relic
07-10-2000, 01:20 AM
The for-next constuct was meant to work that way. Only one SwapBuffers per frame.

Sorry, I don't understand what your problem is now. Read the Redbook on transfomation hierarchies (Example 3.6): http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaweb/SGI_Developer/OpenGL_PG/@Generic__BookView

Claudio
07-10-2000, 01:26 AM
Thanks