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]
Quote:Original post by Lord_VaderI'm going to be lazy and just direct you to this source code.
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)?
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();
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();
Quote:Original post by Anonymous PosterWhat 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).
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.
The code I linked to above implements both 6DOF and 'standard' FPS-style motions (and requires only a basic 3D vector class as support).
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.
jyk's code is fine but a little more documentation is needed
to it.
Quote:Original post by Lord_VaderIf 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.
jyk's code is fine but a little more documentation is needed to it.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement