Log in or register to post comments

How to change Texture depending on the DataSet (or even the image of a same DataSet)

July 19, 2012 - 1:28am #1

Hello,

I would like to change the texture depending on the image i track.

I found this :

// chose the texture based on the target name

int textureIndex;

if (strcmp(trackable->getName(), "chips") == 0)

{

      texureIndex = 0;

}

else if (strcmp(trackable->getName(), "stones") == 0)

{

      textureIndex = 1;

}

else

{

      textureIndex = 2;

}

in ImageTargets.cpp (line 342 to 355).

I would like to know where the name of the trackable is set (because i always get into the 'else' (i.e. textureIndex = 2) ), and if it is possible to change it (so I could make a different texture depending on what image is tracked).

Thanks in advance.

How to change Texture depending on the DataSet ...

July 22, 2012 - 12:04am #3

The name of your trackable is set inside the .xml file. Look for an atribute called "name" then you find the name.

 

How to change Texture depending on the DataSet

July 19, 2012 - 3:34am #2

Hi GabrielS

trackable->getName()

...this is the correct way of getting the name of the trackable, which is set when you upload a trackable at MyTrackables.

Probably the best thing to do is to print a log to the console to find out what exactly is being tracked.  This way you can diagnose the problem more quickly.

It should be possible to change the texture accordingly as you have done, though if you have a large number of textures it might make sense to use a dictionary that uses the name as a lookup to the texture index.

HTH

 

 

 

Log in or register to post comments