Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - rafael_afn

Pages: [1]
1
Support / jPCT + vuforia => multi targets with multi objects
« on: September 11, 2015, 12:35:25 am »
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:
Code: [Select]
@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:
Code: [Select]
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:
Code: [Select]
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);
        }
    }

2
Support / jPCT-AE with Vuforia native Java
« on: May 29, 2015, 08:44:50 am »
I'm trying to integrate jpct with Vuforia for Java. But all examples are meeting for Vuforia native c ++.

With the example posted on the forum <link>, I am unable to modify the image by java database.

What I am trying to say is, I need Vuforia java, because I want to change the Vuforia images database dynamically, so can not use Vuforia native c ++.

Can anyone help me? I'm trying to make it work days.

PS: sorry for the mistakes I'm not American.

Pages: [1]