🎉 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...
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?
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:
Is that what you wanted to know?... No?... well... too bad
-------------
squirrels are a remarkable source of protein...
![](smile.gif)
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
![](smile.gif)
-------------
squirrels are a remarkable source of protein...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement