How can I read and show an .obj in Wikitude Native API?

79 Views Asked by At

I am trying to use Wikitude Native API to write an Android App. I see the Sample code and build imageTracker. I want to make a customView with other .obj from internet on the recognized image. Can any one give some idea or sample code to me please.

What I understand now is that, I should change the strokedRectangle to my objectLoader, and put it into glRenderer.setRenderablesForKey. The objectLoader should extends Renderable. However, what should I do next?

public void onImageRecognized(ImageTracker tracker, final ImageTarget target) {
    Log.v(TAG, "Recognized target " + target.getName());

    StrokedRectangle strokedRectangle = new StrokedRectangle(StrokedRectangle.Type.STANDARD);
    glRenderer.setRenderablesForKey(target.getName() + target.getUniqueId(), strokedRectangle, null);
}
1

There are 1 best solutions below

2
Daniel On

The Wikitude Native SDK itself is oblivious to the concept of augmentation rendering. All the related code (StrokedRectangle, Renderable, Renderer, etc.) is part of the example application layer only, meaning you can get rid of all of it and implement the rendering as you see fit. These classes merely serve as a demonstration of how one could implement the rendering.

Ultimately, all you need to do is receive a view matrix and the field of view from the Wikitude SDK and use them as your rendering input. You will need to create a projection matrix from the latter, which the sample code demonstrates as well.

If you should require additional assistance with the implementation, I'd be happy to have an extended discussion in the Wikitude forums. Stackoverflow does not seem to me to be the appropriate place for such support matters.