Main Menu
Menu

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.

Show posts Menu

Messages - rafael_afn

#1
Support / Re: jPCT-AE with Vuforia native Java
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?
#2
Ok, I will evaluate what is best for my code.

If I start having performance problems, try another approach.

Thank EgonOlsen for responding so quickly.
#3
Hi EgonOlsen

Both ways worked, great.

Apparently had the same performance. Analyzed by the CPU and memory tools on Android Studio.

Create different worlds, cameras and lights have more work to me, than removing all objects and add what I need on moment.

Which of the two approaches do you recommend I use? Because I do not know what the complexity of jPCT for each approach. What it should work better?

Thanks again.
#4
Ok, I'll try your approach.

I implemented this solution:
When I recognize the target 1, remove all objects of my world, I add the object to be printed on this target.
When I recognize the target 2, remove all objects of my world, I add the object to be printed on this target.
(Solution tested and working for two objects. I do not know the behavior for various objects or complex objects)

Now I will try what you said, create an object and a camera for each world. See which has the best performance.

Post the result here so that others can use the same solution.

Thank you
#5
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);
        }
    }
#6
Support / Re: jPCT-AE with Vuforia native Java
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
#7
Support / Re: jPCT-AE with Vuforia native Java
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:

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):
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?
#8
Support / Re: jPCT-AE with Vuforia native Java
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.
#9
Support / Re: jPCT-AE with Vuforia native Java
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.
#10
Support / jPCT-AE with Vuforia native Java
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.