Author Topic: jPCT-AE with Vuforia native Java  (Read 3546 times)

Offline rafael_afn

  • byte
  • *
  • Posts: 10
    • View Profile
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.

Offline rafael_afn

  • byte
  • *
  • Posts: 10
    • View Profile
Re: jPCT-AE with Vuforia native Java
« Reply #1 on: May 29, 2015, 08:49:57 am »
the link with the project I tried to use is https://github.com/fishkingsin/QCAR-JPCT-AE

but as I mentioned, with this example to change the database "StonesAndChips.xml" I build every time I modify the file.

I wish I could modify the database dynamically, it is possible with examples of native java Vuforia.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: jPCT-AE with Vuforia native Java
« Reply #2 on: May 29, 2015, 10:06:22 am »
Personally, I've no experience with Vuforia integration, but I expect the JAVA-API to be similar in terms of the basic logic to the native one. While code will be different of course, the basic logic should apply to it as well. What's your exact problem when trying to integrate it?

Offline rafael_afn

  • byte
  • *
  • Posts: 10
    • View Profile
Re: jPCT-AE with Vuforia native Java
« Reply #3 on: May 29, 2015, 09:35:43 pm »
first thanks for the reply.

I am a beginner and I will try to explain what I want.

I want to use Vuforia to recognize my goals, and the jPCT to View My 3D objects.

I followed some tutorials Vuforia, and to modify the targets of the examples there are two ways: by using c ++ code and ndk or changing the java code.

How I want to change the targets dynamically, I can not use the code in C ++ because I can not perform build on the user's machine.

All examples that meet integration Vuforia with jPCT, use the native Vuforia code in C ++, and this is not helpful to me.

I have two questions:
It's possible I can integrate jPCT with Vuforia without using native code in C ++ Vuforia?
If you can not, can anyone help me to modify the native C ++ code Vuforia, moving to the Java responsibility of setting targets?

I know the question seems to be far more Vuforia side, but only saw the integration happen by jPCT staff, so I think you guys can help me more clearly.

If you need I can post code where this is done in native C ++ and Vuforia as is done in Java, to tell if it is possible.

Thank you.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: jPCT-AE with Vuforia native Java
« Reply #4 on: May 30, 2015, 04:18:21 pm »
Of course you can integrate the Java version as well. At the time at which this tutorial was created, there was no Java API available. The basic logic should be no different, just the API calls. Somebody once tried to use the Java API instead of the native one, but I don't know how far he got...

Offline rafael_afn

  • byte
  • *
  • Posts: 10
    • View Profile
Re: jPCT-AE with Vuforia native Java
« Reply #5 on: June 03, 2015, 06:53:56 am »
Ok, I tried to follow in the footsteps of wiki http://www.jpct.net/wiki/index.php/Integrating_JPCT-AE_with_Vuforia

I was replacing the native parts in their parts in java.

I'm having problems in this excerpt:
Code: [Select]
public void updateCamera () {
        Matrix m = new Matrix ();
        m.setDump (modelViewMat);
        cam.setBack (m);
    }


The object modelViewMat this nullo, this triggers an exception and closes the app.

I believe that the problem may be happening here (on renderFrame method, on ImageTargetRenderer):
Code: [Select]
for (int tIdx = 0; tIdx <state.getNumTrackableResults (); tIdx ++) {
            TrackableResult result = state.getTrackableResult (tIdx);
            Trackable trackable result.getTrackable = ();
            printUserData (trackable);
            Matrix44F modelViewMatrix_Vuforia = Tool.convertPose2GLMatrix (result.getPose ());
            float [] = modelViewMatrix modelViewMatrix_Vuforia.getData ();
            // Should rotate the object data.

            updateModelviewMatrix (modelViewMatrix);
}

Because running debug, this loop is never executed. Causing the modelViewMatrix attribute is null.

Can you help me or indicate some literature?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: jPCT-AE with Vuforia native Java
« Reply #6 on: June 04, 2015, 07:26:23 am »
If that loop never does anything, getNumTrackableResults() seems to return something <=0. I would try to work my way through the Vuforia documentation to find out what that means. It's not a jPCT and maybe not even a porting issue. It might simply be a wrong setup on your side. Either that, or it's normal and you have to deal with the fact that there might be no objects to track.

Offline rafael_afn

  • byte
  • *
  • Posts: 10
    • View Profile
Re: jPCT-AE with Vuforia native Java
« Reply #7 on: June 05, 2015, 10:22:49 pm »
EgonOlsen thanks for the answers, I could figure out the problem, it was a setting in Vuforia. I was not using the proper target image.

I am now able to view the cube, as in the example hello world. I tried two things:
  - Set up the camera, because the hub of the movement behaves very strangely, I believe it is the exchange of Vuforia coordinates for jpct.

  - View my own 3d object (.obj).

Following the tutorials, I see the answers in the forums and yet, I can not make it work. I will resume it next week and come back with more questions.

thank you again

Offline anusha.r04

  • byte
  • *
  • Posts: 2
    • View Profile
Re: jPCT-AE with Vuforia native Java
« Reply #8 on: November 13, 2015, 11:27:29 am »
Im also facing the same problem
public void updateCamera() {


    com.threed.jpct.Matrix m = new com.threed.jpct.Matrix();
    m.setDump(modelViewMat);
    cam.setBack(m);


modelViewMatrix is null, could you let me know how you fixed it

Offline rafael_afn

  • byte
  • *
  • Posts: 10
    • View Profile
Re: jPCT-AE with Vuforia native Java
« Reply #9 on: December 04, 2015, 07:52:41 pm »
Hello anusha.r04, See if it helps you

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);
        }
    }

in 'renderFrame' is necessary to capture the Vuforia coordinates and turn to jpct, you are already managing to do this?