at each iteration, the trackable is set to the following:
QCAR::Trackable *trackable = state.getActiveTrackable( tIdx );
so, there is no relationship between trackable at iteration tIdx = 0 and trackable at iteration tIdx = 1; every iteration (tIdx = 0, tIdx = 1, tIdx = 2 etc...) has its own trackable, and therefore its own pose (trackable->getPose()).
So, they all represents different objects.
Then, when you render an object at a certain iteration, you can use different vertexArrays depending on the name of the trackable at currrent iteration, i.e. something like the following code snippet:
for(int tIdx = 0; tIdx < state.getNumActiveTrackables(); tIdx++)
{
// Get the trackable:
const QCAR::Trackable* trackable = state.getActiveTrackable(tIdx);
QCAR::Matrix44F modelViewMatrix = QCAR::Tool::convertPose2GLMatrix(trackable->getPose());
QCAR::Matrix44F modelViewProjection;
SampleUtils::translatePoseMatrix(0.0f, 0.0f, kObjectScale, &modelViewMatrix.data[0]);
SampleUtils::scalePoseMatrix(kObjectScale, kObjectScale, kObjectScale, &modelViewMatrix.data[0]);
SampleUtils::multiplyMatrix(&projectionMatrix.data[0], &modelViewMatrix.data[0] , &modelViewProjection.data[0]);
glUseProgram(shaderProgramID);
if (strcmp(trackable->getName(), "chips") == 0)
{// if target is "chips" then we use nyancat mesh
glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &nyancatVertices[0]);
glVertexAttribPointer(texCoordHandle, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &nyancatTexCoords[0]);
glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &nyancatNormals[0]);
}
else if (strcmp(trackable->getName(), "stones") == 0)
{ //if target is "Stones" then we use banana mesh
glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &bananaVertices[0]);
glVertexAttribPointer(texCoordHandle, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &bananaTexCoords[0]);
glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &bananaNormals[0]);
}
// etc ...
}
at each iteration, the trackable is set to the following:
QCAR::Trackable *trackable = state.getActiveTrackable( tIdx );
so, there is no relationship between trackable at iteration tIdx = 0 and trackable at iteration tIdx = 1; every iteration (tIdx = 0, tIdx = 1, tIdx = 2 etc...) has its own trackable, and therefore its own pose (trackable->getPose()).
So, they all represents different objects.
Then, when you render an object at a certain iteration, you can use different vertexArrays depending on the name of the trackable at currrent iteration, i.e. something like the following code snippet:
for(int tIdx = 0; tIdx < state.getNumActiveTrackables(); tIdx++)
{
// Get the trackable:
const QCAR::Trackable* trackable = state.getActiveTrackable(tIdx);
QCAR::Matrix44F modelViewMatrix = QCAR::Tool::convertPose2GLMatrix(trackable->getPose());
QCAR::Matrix44F modelViewProjection;
SampleUtils::translatePoseMatrix(0.0f, 0.0f, kObjectScale, &modelViewMatrix.data[0]);
SampleUtils::scalePoseMatrix(kObjectScale, kObjectScale, kObjectScale, &modelViewMatrix.data[0]);
SampleUtils::multiplyMatrix(&projectionMatrix.data[0], &modelViewMatrix.data[0] , &modelViewProjection.data[0]);
glUseProgram(shaderProgramID);
if (strcmp(trackable->getName(), "chips") == 0)
{// if target is "chips" then we use nyancat mesh
glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &nyancatVertices[0]);
glVertexAttribPointer(texCoordHandle, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &nyancatTexCoords[0]);
glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &nyancatNormals[0]);
}
else if (strcmp(trackable->getName(), "stones") == 0)
{ //if target is "Stones" then we use banana mesh