🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Models in space...

Started by
1 comment, last by Ozz 23 years, 11 months ago
How do I get a model to stay where it is in space while a change the cameras orientation, instead of having the model out in front of the camera while the camera moves?
Advertisement
glPushMatrix() and glPopMatrix()

JoeMont001@aol.com www.polarisoft.n3.net
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
Just to expand on that minimalist reply , yes, the way to preserve the camera (or any other) transform is to push and pop matrices.

This is a simple example of how to lay out your render func:
    void Render(){    //clear your buffers if you want    glClear(...);    //apply your camera transform    //remember... rotate THEN translate    glRotatef(...);    ...    glTranslatef(...);    //now you draw all your objects    for(int i = 0; i < numObjects; i++)    {        glPushMatrix();    //save view transform        //apply local transforms        glTranslatef(...);        glRotatef(...);        ...        objects(i)->DrawYourselfDammit();        glPopMatrix();     //restore view transform    }    glFlush()/Swapbuffers(hDC)/whatever;}    

Is that what you wanted to know?... No?... well... too bad

-------------
squirrels are a remarkable source of protein...

This topic is closed to new replies.

Advertisement