Camera Update and Perspective Issues in SWT


I have been facing this problem for quite some time now and now I really need some hints as to what is happening. The scenario is as follows

I am using JME2 and the SWT implementation. I initially set the camera in parallel projection mode and set an isometric view by setting the cam location to 50,50,50 and looking at the origin (0,0,0). This works fine

On resize, i want to update the prespective based on the aspect ratio by setting the frustum values and updating the cam.

Now when this happens, my cam seems to see absolutely nothing.

If I comment out the cam.update() line, it seems fine but then the screen to world coordinate conversion is erroneous!

I am attaching a code snippet below for the cam update function.

float aspect = (float) p.x / (float) p.y;
Camera cam = impl.getCamera(); // impl is the SimpleCanvasImpl instance

float fNear = cam.getFrustumNear();
float fFar = cam.getFrustumFar();

float d = 50f;

float fLeft = -d * aspect;
float fRight = + d * aspect;
float fTop =  + d;
float fBottom =  - d;

cam.setFrustum(fNear, fFar, fLeft, fRight, fTop, fBottom);

I am new to jME and have been searching the forum but could not find a proper solution. I would really appreciate any help / hints!


Are you still struggling with this?

Maybe you can post a SimpleGame example, one can easily copy/paste and run, so its easier to reproduce the problem and spot an error.

Thanks but i went back to perspective projection from parallel projection so the problem has been escaped from rather than solved! :frowning: