Hi
I did Vuforia integration with jpct using native java \ o /
I would like to be able to print two objects on the screen in different targets.
In onDrawFrame method I have those calls:
@Override
public void onDrawFrame(GL10 gl){
if (!mIsActive)
return;
// Call our function to render content
renderFrame();
updateCamera();
if(isMarker){
world.renderScene(fb);
world.draw(fb);
GLES20.glDisable(GLES20.GL_DEPTH_TEST);
}else{
fb.flush();
}
fb.display();
}
In renderFrame, the targets are recognized in this code snippet:
for (int tIdx = 0; tIdx < state.getNumTrackableResults(); tIdx++) {
TrackableResult result = state.getTrackableResult(tIdx);
Trackable trackable = result.getTrackable();
printUserData(trackable);
modelViewMatrix_Vuforia = Tool.convertPose2GLMatrix(result.getPose());
Matrix44F inverseMV = SampleMath.Matrix44FInverse(modelViewMatrix_Vuforia);
Matrix44F invTranspMV = SampleMath.Matrix44FTranspose(inverseMV);
modelViewMatrix = invTranspMV.getData();
//LANDSCAPE: 0, 180.0f, 0, 0, 1.0f
//PORTRAIT: 0, -90.0f, 0, 0, 1.0f
Matrix.rotateM(modelViewMatrix, 0, 90.0f, 0, 0, 1.0f);
mCameraPosition = new SimpleVector(modelViewMatrix[12], modelViewMatrix[13], modelViewMatrix[14]);
mCameraDirection = new SimpleVector(modelViewMatrix[8], modelViewMatrix[9], modelViewMatrix[10]);
//LANDSCAPE: 0, 1, 2
//PORTRAIT: 4, 5, 6
mCameraUp = new SimpleVector(-modelViewMatrix[0], -modelViewMatrix[1], -modelViewMatrix[2]);
SampleUtils.checkGLError("Render Frame");
}
Note that the camera coordinates are defined for each detected target.
But the camera is only updated the loop end, then it only receives the coordinate of the last target. (See the order of calls onDrawFrame)
I need to draw an object in the target 1 and B 2 on the target object.
Can anyone help me, I can not imagine how to upgrade the camera coordinates to display the object and then upgrade to display object B.
updateCamera method:
public void updateCamera() {
if (modelViewMatrix != null) {
com.threed.jpct.Matrix m = new com.threed.jpct.Matrix();
m.setDump(modelViewMatrix);
cam.setBack(m);
cam.setOrientation(mCameraDirection, mCameraUp);
cam.setPosition(mCameraPosition);
}
}