Jump to content
  • Advertisement
Sign in to follow this  
Lord_Vader

Camera

This topic is 4217 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all, Can anyone tell me how to create a space camera that rotates only relatively to its own axes(that they are const oriented relatively to the camera(or the model)? thanks [Edited by - Lord_Vader on January 27, 2007 5:20:10 AM]

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Lord_Vader
Hello all, Can anyone tell me how to create a space camera that rotates only relatively to its own axes(that they are const oriented relatively to the camera(or the model)?
I'm going to be lazy and just direct you to this source code.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Not exactly sure what you are getting at, however...

When you are using the MODELVIEW matrix stack it defaults to the viewing stack and any rotations/translations etc... you do will transform your camera/world.

Now if you want to transform an individual object, before you give gl it's vertices's you must call glPushMatrix(), then any transformations you do will effect only those vertices's on their local coordinate system. Should usually make a call to glLoadIdentity() before you transform, to clear any left overs in that matrix.

Don't forget to call glPopMatrix() after that object is done being transformed/vertexed(gave the vertex coord's). Or else you will be in MODEL mode the whole time.

ex...

glPushMatrix();

glTranslatef(10,0,0);
glRotatef(angle, 1,0,0);
m_drawCubeVerts();

glPopMatrix();

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
Not exactly sure what you are getting at, however...

When you are using the MODELVIEW matrix stack it defaults to the viewing stack and any rotations/translations etc... you do will transform your camera/world.

Now if you want to transform an individual object, before you give gl it's vertices's you must call glPushMatrix(), then any transformations you do will effect only those vertices's on their local coordinate system. Should usually make a call to glLoadIdentity() before you transform, to clear any left overs in that matrix.

Don't forget to call glPopMatrix() after that object is done being transformed/vertexed(gave the vertex coord's). Or else you will be in MODEL mode the whole time.
What the OP is getting at is the problem of 6DOF motion, which the above does not address. 6DOF motion cannot be implemented in a direct way via OpenGL calls alone (at least not without awkward and perhaps costly state queries).

The code I linked to above implements both 6DOF and 'standard' FPS-style motions (and requires only a basic 3D vector class as support).

Share this post


Link to post
Share on other sites
I tried and I dont think its possible only with simple glTranslate and glRotate calls.

jyk's code is fine but a little more documentation is needed
to it.

Share this post


Link to post
Share on other sites
Quote:
Original post by Lord_Vader
jyk's code is fine but a little more documentation is needed to it.
If you have specific questions about the code, feel free to post them here (or PM me if you prefer), and I'll be happy to try and help.

Share this post


Link to post
Share on other sites
Quote:
Original post by jyk
If you have specific questions about the code, feel free to post them here (or PM me if you prefer), and I'll be happy to try and help.


I have found your code very useful. I am trying to make it work with my little engine...

thanks again

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!