using glGetFloatv() in torque
by Bendik Stang · in Torque Game Engine · 02/14/2003 (9:21 am) · 1 replies
I'm trying to get the current position, and in openGL would use this code:
I have figured out that tge uses SceneState, but the above call is made in a separate object, and so will I need to pass the SceneState to the object or is there some 'global' way of accessing it?
Will I need to
#include "sim/sceneObject.h"
or
#include "sceneGraph/sceneGraph.h"
?
I have tried this too:
its not working, but is this the right approach?
I find this rather confusing.
Any tips or directions would be appreciated.
-Bendik
Point3F pos1; Matrix4f temp; // TGE would use the MatrixF object instead. glMatrixMode(GL_MODELVIEW); glGetFloatv(GL_MODELVIEW_MATRIX,&temp[0][0]); pos1[0] = temp[3][0]; pos1[1] = temp[3][1]; pos1[2] = temp[3][2];
I have figured out that tge uses SceneState, but the above call is made in a separate object, and so will I need to pass the SceneState to the object or is there some 'global' way of accessing it?
Will I need to
#include "sim/sceneObject.h"
or
#include "sceneGraph/sceneGraph.h"
?
I have tried this too:
#include "dgl/dgl.h" MatrixF temp; dglGetModelview(&temp); pos1.set(temp.getPosition); glTranslatef(l,0,0); dglGetModelview(&temp); pos2.set(temp.getPosition);
its not working, but is this the right approach?
I find this rather confusing.
Any tips or directions would be appreciated.
-Bendik
Torque 3D Owner Pat Wilson
[ 1][ 5][ 9][13]
[ 2][ 6][10][14]
[ 3][ 7][11][15]
[ 4][ 8][12][16]
The Torque Matricies (as well as D3D) use row-major format, like so:
[ 1][ 2][ 3][ 4]
[ 5][ 6][ 7][ 8]
[ 9][10][11][12]
[13][14][15][16]
So keep that in mind whenever you make direct GL calls involving matrices and the Torque matrix structure. What exactly are you trying to get the position of? There are easier ways of doing it. The getTransform() method being one of them.