Cardboard ,CardboardView support

Started by mxar, December 05, 2018, 01:26:17 PM

Previous topic - Next topic

mxar

Hi,

I try to develop a Virtual Reality application using Google's Cardboard Java API.

Do you have any example?

I have a big problem adjusting JPCT's coordination system with Cardboard's Java API coordinate system.

I think the solution exists in the method
public void onDrawEye(Eye eye)

My code is:

@Override
    public void onDrawEye(Eye eye) {

       com.threed.jpct.Matrix camBack = world.getCamera().getBack();
        camBack.setIdentity();
        tempTransform.setDump(eye.getEyeView());

        tempTransform.transformToGL();
        camBack.matMul(tempTransform);

        world.getCamera().setBack(camBack);

         fb.clear(RGBColor.BLACK);
         fb.clearZBufferOnly();

         world.renderScene(fb);
         world.draw(fb);

         fb.display();
}


The Objects3D models added to the world  don't look ok according to the XYZ positions a I have set.


I suppose the problem is because JPCT uses a different coordinate system than OpenGL.

Can you suggest a solution?

Thanks in advance



EgonOlsen

Might be because the matrix from the cardboard API is a view matrix while jPCT's camera matrix is a rotation matrix. Have you looked at this example: http://www.jpct.net/wiki/index.php?title=Example_for_Google_Cardboard?

mxar


Many thanks!!!

Great example.

Also I have another question:

Primitives.getCube(scale) method, creates a cube rotated 45 degrees around Y axis?

Thanks in advance

EgonOlsen

Yes. That's caused by the way in which these objects are build. I think ExtendedPrimitives does it differently.