Hi.
This s a followup question to the one I asked here http://www.gamedev.net/topic/640939-projection-matrix-issue/.
In order to pull the near clipping pane close to the camera I had to scale all the values (except for far clipping pane) to glFrustum smaller. This works except it creates alot of jitter in animating models. Im asuming its some kind of percision error. I thought that the solution would simply be to move the far clipping pane closer as wel but no matter how close I move it the jitter remains.
How should I improve this?
Thanks in Advance!
[source]
//old values
//l = -1.0;
//r = 1.0;
//b = -768.0 / 1024.0; //-height / width
//t = 768.0 / 1024.0; //height / width
//n = 1.0; //near clipping pane
//f = 10000.0; //far clipping pane
//new values with clipping pane moved closer but with unacceptable jitter
//l = -0.1;
//r = 0.1;
//b = -768.0 / 1024.0 / 10; //-height / width
//t = 768.0 / 1024.0 / 10; //height / width
//n = 0.1; //near clipping pane
//f = 10000.0; //far clipping pane
public static Matrix4 glFrustum(float l, float r, float b, float t, float n,float f)
{
FloatBuffer fb = FloatBuffer.allocate(16);
fb.put((2*n)/(r-l));
fb.put(0);
fb.put(0);
fb.put(0);
fb.put(0);
fb.put((2*n)/(t-b));
fb.put(0);
fb.put(0);
fb.put((r+l)/(r-l));
fb.put((t+b)/(t-b));
fb.put(-(f+n)/(f-n));
fb.put(-1);
fb.put(0);
fb.put(0);
fb.put((-2*f*n)/(f-n));
fb.put(0);
return new Matrix4(fb);
}
[/source]