- Sort Posts
- 9 replies
- Last post
can we load as our custom view while the targets get detected in videoplayback sample.
can we load as our custom view while the targets get detected in
can we load as our custom view while the targets get detected in
can we load as our custom view while the targets get detected in
can we load as our custom view while the targets get detected in
Hi,
that's because the article still refers to the 1.5 API; so, you need to replace getNumActiveTrackables() with getNumTrackableResults() and also replace getActiveTrackable( tIdx) with getTrackableResult( tIdx ); essentially your "for loop" must be updated as shown here:
for(int tIdx = 0; tIdx < state.getNumTrackableResults(); tIdx++) { // Get the trackable: const QCAR::TrackableResult* result = state.getTrackableResult(tIdx); const QCAR::Trackable& trackable = result->getTrackable();
Also, trackable->getName() must be replaced by trackable.getName(), and trackable->getId() must be replaced by trackable.getId()
can we load as our custom view while the targets get detected in
i followed the link but i am getting the follwong error.
--------------------------------------------------------------------------------
C:\Developement\adt-bundle-windows\vuforia-sdk-android-2-0-29\samples\ImageTarge
ts-2-0-7>C:\Developement\adt-bundle-windows\android-ndk-r8c\ndk-build
"Compile++ arm : ImageTargets <= ImageTargets.cpp
jni/ImageTargets.cpp: In function 'void Java_com_qualcomm_QCARSamples_ImageTarge
ts_ImageTargetsRenderer_renderFrame(JNIEnv*, jobject)':
jni/ImageTargets.cpp:345:34: error: 'class QCAR::State' has no member named 'get
NumActiveTrackables'
jni/ImageTargets.cpp:348:50: error: 'class QCAR::State' has no member named 'get
ActiveTrackable'
make: *** [obj/local/armeabi/objs/ImageTargets/ImageTargets.o] Error 1
----------------------------------------------------------------------------------------------------------
my renderframe method of cpp file is like this..
int lastTrackableId = -1;
JNIEXPORT void JNICALL
Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargetsRenderer_renderFrame(JNIEnv* env, jobject obj)
{
//LOG("Java_com_qualcomm_QCARSamples_ImageTargets_GLRenderer_renderFrame");
// Clear color and depth buffer
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Get the state from QCAR and mark the beginning of a rendering section
QCAR::State state = QCAR::Renderer::getInstance().begin();
// Explicitly render the Video Background
QCAR::Renderer::getInstance().drawVideoBackground();
#ifdef USE_OPENGL_ES_1_1
// Set GL11 flags:
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnable(GL_TEXTURE_2D);
glDisable(GL_LIGHTING);
#endif
glEnable(GL_DEPTH_TEST);
// We must detect if background reflection is active and adjust the culling direction.
// If the reflection is active, this means the post matrix has been reflected as well,
// therefore standard counter clockwise face culling will result in "inside out" models.
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
if(QCAR::Renderer::getInstance().getVideoBackgroundConfig().mReflection == QCAR::VIDEO_BACKGROUND_REFLECTION_ON)
glFrontFace(GL_CW); //Front camera
else
glFrontFace(GL_CCW); //Back camera
for(int tIdx = 0; tIdx<state.getNumActiveTrackables(); tIdx++)
{
// Get the trackable:
const QCAR::Trackable* trackable = state.getActiveTrackable(tIdx);
// Compare this trackable's id to a globally stored id
// If this is a new trackable, find the displayMessage java method and
// call it with the trackable's name
if (trackable->getId() != lastTrackableId) {
jstring js = env->NewStringUTF(trackable->getName());
jclass javaClass = env->GetObjectClass(obj);
jmethodID method = env->GetMethodID(javaClass, "displayMessage", "(Ljava/lang/String;)V");
env->CallVoidMethod(obj, method, js);
lastTrackableId = trackable->getId();
}
}
glDisable(GL_DEPTH_TEST);
#ifdef USE_OPENGL_ES_1_1
glDisable(GL_TEXTURE_2D);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
#else
glDisableVertexAttribArray(vertexHandle);
glDisableVertexAttribArray(normalHandle);
glDisableVertexAttribArray(textureCoordHandle);
#endif
QCAR::Renderer::getInstance().end();
}
what things i need to do more to make this working.?
can we load as our custom view while the targets get detected in
can we load as our custom view while the targets get detected in
Hi, you can follow this tutorial:
https://developer.vuforia.com/resources/dev-guide/open-web-site-and-display-toast-target-detection
the page is not availabl.. could you pls some other link
thank you