this is my current camera code.
package com.google.sites.lvgeeks.deepthought.utils.opengl;
import javax.media.opengl.*;
import javax.media.opengl.glu.*;
public class simplecam {
public static void look(GL gl,GLU glu,int FOV,float aspectratio, int atx, int aty, int atz, int yaw, int pitch)
{
while(pitch>360||pitch<0)
{
if(pitch>360)
{
pitch-=360;
}
if(pitch<0)
{
pitch+=360;
}
}
while(yaw>360||yaw<0)
{
if(yaw>360)
{
yaw-=360;
}
if(yaw<0)
{
yaw+=360;
}
}
double yawrad = (Math.PI*yaw)/180;
double pitchrad = (Math.PI*pitch)/180;
int lookz=atz+(int)(30*Math.cos(yawrad));
int lookx=atx+(int)(30*Math.sin(yawrad));
int looky=aty+(int)(30*Math.tan(pitchrad));
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluPerspective(FOV, aspectratio, 0.5, 9000);
glu.gluLookAt(atx, aty, atz, lookx, looky, lookz, 0, 1, 0);
//System.out.println(lookx+" "+ looky+" "+ lookz);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();
}
}
how can i add roll to my camera?
Thanks in advance!!