Hello, im having dificultys loading the player position and view direction into a matrix for shader use.
I got a immediate mode version working what seems to work:
glRotatef(xrot,0f,1f,0f);
glRotatef(yrot,xdelta,0f,zdelta);
glTranslatef(-x, -y, -z);
Hover loading the stuff into a matrix gives odd results:
Panel.getRotation().setIdentity();
Panel.getRotation().rotate(FastMath.DegtoRad(xrot), new Vector3f(0f,1f,0f));
Panel.getRotation().rotate(FastMath.DegtoRad(yrot), new Vector3f(xdelta,0f,zdelta));
//I suspect this function benig wrong, does anyone have a standard implementation?
Panel.getRotation().Move(-x, -y, -z);
For reference:
xrot += mousedeltax/6f;
yrot = ((mousey/Panel.getHeight()) * 180) - 90;
xdelta = (float)(Math.cos(Math.toRadians(xrot)));
zdelta = (float)(Math.sin(Math.toRadians(xrot)));
Thanks for any info.