Log in or register to post comments

How to use many trackables in a same imagetarget application..

March 15, 2012 - 8:33am #1

How to use many trackables in a same imagetarget application..and display different objects based on trackable...

Which all files needs to b edited??

som1 pls explain...

Re: How to use many trackables in a same imagetarget application

March 18, 2012 - 8:44pm #8

yup...I mean I want to merge application only....I hav alread created other app which i want to merge ...I would try calling that activity from ImageTarget on some action.....thanx a lot ksiva for ur ans...I vil try doin dis

Re: How to use many trackables in a same imagetarget application

March 18, 2012 - 7:04pm #7

I'm not sure I understand. Typically you would create a single application, by merging the Vuforia sample code and your application-specific code.

You also can start another application (intent) from your own:

http://stackoverflow.com/questions/2780102/open-another-application-from-your-own-intent

- Kim

Re: How to use many trackables in a same imagetarget application

March 18, 2012 - 11:20am #6

ty Ksiva....I tried with two trackables and it worked great....now i vil try to get video played over other trackers vid the help post in this forum...

The other thing which i wanted to ask was..
Is it possible to hav other application java classes vid this imagetarget files....i.e. for eg...if I let the application initialize with qualcomm settings and then if i giv path to other app by selecting button from menu....vil it work???

Re: How to use many trackables in a same imagetarget application

March 18, 2012 - 8:33am #5

So it sounds like you just want to change the texture depending on the target, not the entire model. Is that correct?

In that case, it's pretty easy:

1) Add your additional texture image files to the assets folder.
2) Update the loadTextures() method in ImageTargets.java to load your image files.
3) Choose the texture in the ImageTargets.cpp renderFrame method, using something like this:

int textureIndex = 0;

// note that strcmp returns 0 when the strings are equal
if (strcmp(trackable->getName(), "mytarget1") == 0)
{
    textureIndex = 0;
}
else if (strcmp(trackable->getName(), "mytarget2") == 0)
{
    textureIndex = 1;
}
else if (strcmp(trackable->getName(), "mytarget3") == 0)
{
    textureIndex = 2;
}
else if (strcmp(trackable->getName(), "mytarget4") == 0)
{
    textureIndex = 3;
}

The textureIndex is an index into the textures array. The order of textures in this array is the same as the order in which you added the textures in the Java loadTextures() method.

- Kim

Re: How to use many trackables in a same imagetarget application

March 16, 2012 - 10:15am #4

And 1 more doubt.....Where is the mapping of target file to texture file done??
I mean may be i vil hav to modify that also??

Re: How to use many trackables in a same imagetarget application

March 16, 2012 - 10:13am #3

Hello ksiva...Thanx for your valuable inputs..
Wel to begin with...

i went through both imagetarget.cpp and framemarker.cpp render methods...
I think the changes which are required to be made are---
i vil have to hav a switch case which assigns textureID by comparing names...like it is done here

int textureIndex = (!strcmp(trackable->getName(), "stones")) ? 0 : 1;

i am not sure...Is it correct....

The other change which i need to make is to change ImageTarget.java file...it should load texture for all 4 targets ....

Is their any other change which i need to make???

Re: How to use many trackables in a same imagetarget application

March 15, 2012 - 7:50pm #2

I suggest taking a look at the FrameMarkers sample. Study the renderFrame method in FrameMarkers.cpp. It renders a different model on each of four markers. The same concept can be used with image targets.

- Kim

Log in or register to post comments