Error in LWJLCamera - method getModelViewMatrix returns allways identity

In build 03/28/07 LWJGLCamera getModelViewMatrix is broken - Allways return identity matrix.

The sample bellow with older build returns this:



INFO: Camera created.

m=com.jme.math.Matrix4f

[

-1.0  0.0  0.0  0.0

0.0  1.0  0.0  0.0

0.0  0.0  -1.0  0.0

0.0  0.0  0.0  1.0

]



and with the current build returns:

INFO: Camera created.

m=com.jme.math.Matrix4f

[

1.0  0.0  0.0  0.0

0.0  1.0  0.0  0.0

0.0  0.0  1.0  0.0

0.0  0.0  0.0  1.0

]





import com.jme.renderer.ColorRGBA;

import com.jme.renderer.lwjgl.LWJGLCamera;

import com.jme.system.DisplaySystem;



public class Test1 {

protected DisplaySystem display;

    protected LWJGLCamera cam;

    int width=1024;

    int height=768;

    int depth=32;

    int freq=75;

    boolean fullScreen=false;



public static void main(String[] args) {

                  Test1 test=new Test1();

  test.createDisplayWindow();



}

   

    void createDisplayWindow() { 

        try {

            display = DisplaySystem.getDisplaySystem();

            display.createWindow( width,height,depth, freq, fullScreen);

            //display.createHeadlessWindow (width,height,depth);

            cam = (LWJGLCamera)display.getRenderer().createCamera( display.getWidth(),

                    display.getHeight() );

            display.getRenderer().setBackgroundColor( ColorRGBA.black );

            display.getRenderer().setCamera( cam );

           

            com.jme.math.Matrix4f m4f=((LWJGLCamera)cam).getModelViewMatrix();

            System.out.println("m="+m4f);

            System.exit( 1 );

        } catch ( Exception e ) {

            e.printStackTrace();

            System.exit( 1 );

        }     

    } 

}

I've updated this class locally to contain an apply() method call right before the return statements in getProjectionMatrix() and getModelViewMatrix().  This should force an update to the matrix.  Expect the change in the next cvs commit.

I found the problem, can someone with access to code fix it:



getModelViewMatrix in LWJLCamera calls onFrameChange that actually fills in the matrix:



onFrameChange in last version:

This change was intentional.  The GL calls are now put off until apply() is called on the camera.  It looks like the get***Matrix calls should have either this method or a doXXXChange method call added to them though.

This should not happen in a normal application (apply is called each frame). getModelViewMatrix and getProjectionMatrix return the last applied matrix. Please call cam.apply() before reading values in your testcase.

I have removed the apply calls - see this post.