Hi,
I asked this before in another thread but I could't fix. Firstly, I'm able to show a Toast with the name of each trackable that appear on the screen, so I manage to recognise my own trackable loading the dataSet...etc. Secondly with the help of the other thread, where I asked before this issue, I could show another 3d object show it seem that I manage to do this too. But I could do that 2 thing at the same time, the object don't appear with my trackable, although the toast and other Android UI yes they do; and at the same time with te stone/chip sample the new 3d object worked.
Here I load the dataSet:
[quote] dataSetMeninas = imageTracker->createDataSet(); if (dataSetMeninas == 0) { LOG("Failed to create a new tracking data."); return 0; } if (!dataSetMeninas->load("Meninas.xml", QCAR::DataSet::STORAGE_APPRESOURCE)) { LOG("Failed to load data set."); return 0; } // Activate the data set: if (!imageTracker->activateDataSet(dataSetMeninas)) { LOG("Failed to activate data set."); return 0; } LOG("Successfully loaded and activated data set."); return 1;[/quote]
And here I load the 3d object after the Android UI components:
[quote] // Draw object: glBindTexture(GL_TEXTURE_2D, thisTexture->mTextureID); glVertexPointer(3, GL_FLOAT, 0, pruebaVerts); glNormalPointer(GL_FLOAT, 0, pruebaNormals); glTexCoordPointer(2, GL_FLOAT, 0, pruebaTexCoords); glDrawElements(GL_TRIANGLES, NUM_TEAPOT_OBJECT_INDEX, GL_UNSIGNED_SHORT, (const GLvoid*) &teapotIndices[0]);#else 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); glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &pruebaVerts[0]); glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &pruebaNormals[0]); glVertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &pruebaTexCoords[0]); glEnableVertexAttribArray(vertexHandle); glEnableVertexAttribArray(normalHandle); glEnableVertexAttribArray(textureCoordHandle); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, thisTexture->mTextureID); glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE, (GLfloat*)&modelViewProjection.data[0] ); glDrawArrays(GL_TRIANGLES, 0, pruebaNumVerts);[/quote]
Could anyone help me? If not, told me to look for another way to do what I want.
Thanks.
Show a 3D object with my own Trackable
So the Trackable is being detected (e.g. you are seeing the Toast ) but the associated model is not being rendered on the target? - and this model does render correctly when using the stones and chips dataset?
Show a 3D object with my own Trackable
[quote=DavidBeard]
So the Trackable is being detected (e.g. you are seeing the Toast ) but the associated model is not being rendered on the target? - and this model does render correctly when using the stones and chips dataset?
Show a 3D object with my own Trackable
I recommend that you test w/ the sample dataset in this same context, and if the model appears, try increasing your scale factor, which is defined on line 81 in ImageTargets.cpp. The target's size defines the scene's unit scale and the model will be scaled and positioned proportional to this.
Show a 3D object with my own Trackable
Ok, it's fixed. The problem was that the 3D model was too big to the screen, I had that value in 100.f
thanks