I seem to have some problems with a function that was/wasn’t ported to JOGL from the native code. The error occurs when I try to call gl.multMatrix( m ). If anyone can point me in the right direction, I would be greatful.
import net.java.games.jogl.*;
public class CCamera
{
public float MaxPitchRate,
PitchDegrees,
MaxHeadingRate,
HeadingDegrees,
MaxRollRate,
RollDegrees,
MaxVelocity,
Velocity;
public CQuaternion4 Heading = new CQuaternion4(),
Pitch = new CQuaternion4(),
Roll = new CQuaternion4();
public GLU glu;
public GL gl;
public CPoint3 PositionPoint = new CPoint3();
public CVector3 DirectionVector = new CVector3();
public void CCamera()
{
MaxPitchRate = 0.0f;
PitchDegrees = 0.0f;
MaxHeadingRate = 0.0f;
HeadingDegrees = 0.0f;
MaxRollRate = 0.0f;
RollDegrees = 0.0f;
MaxVelocity = 0.0f;
Velocity = 0.0f;
}
public void SetPerspective()
{
CMatrix16 PerspectiveMatrix = new CMatrix16();
CQuaternion4 PerspectiveQuaternion = new CQuaternion4();
Pitch.CreateFromAxisAngle(0.0f, 0.0f, 0.0f, PitchDegrees);
Heading.CreateFromAxisAngle(0.0f, 1.0f, 0.0f, HeadingDegrees);
PerspectiveQuaternion = Pitch.Cross(Heading);
PerspectiveQuaternion.CreateMatrix(PerspectiveMatrix);
//////////////////////////////////ERROR HERE
gl.multMatrix( PerspectiveMatrix.Data );
///////////////////////////////////////
PerspectiveQuaternion.CreateMatrix(PerspectiveMatrix);
DirectionVector.y = PerspectiveMatrix.Data[9];
PerspectiveQuaternion = Heading.Cross(Pitch);
PerspectiveQuaternion.CreateMatrix(PerspectiveMatrix);
DirectionVector.x = PerspectiveMatrix.Data[8];
DirectionVector.z = PerspectiveMatrix.Data[10];
DirectionVector = DirectionVector.ScalarMult(Velocity);
PositionPoint.x = PositionPoint.x + DirectionVector.x;
PositionPoint.y = PositionPoint.y + DirectionVector.y;
PositionPoint.z = PositionPoint.z + DirectionVector.z;
gl.glTranslatef(-PositionPoint.x, -PositionPoint.y, PositionPoint.z);
}
}
I actually ported this code from C++ from a tutorial found at GameTutorials.com, but I seem to get stuck here. Thank you in advance. (By the way: the whole class isn’t here, just the first half of it.)
Cheers!