JNIEXPORT int JNICALL Java_rajawali_vuforia_RajawaliVuforiaActivity_createFrameMarker(JNIEnv* env, jobject object, jint markerId, jstring markerName, jfloat width, jfloat height) { QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance(); QCAR::Tracker* trackerBase = trackerManager.getTracker( QCAR::MarkerTracker::getClassType()); if (trackerBase != 0) { QCAR::MarkerTracker* markerTracker = static_cast<QCAR::MarkerTracker*>(trackerBase); const char *nativeString = env->GetStringUTFChars(markerName, NULL); if (!markerTracker->createFrameMarker((int) markerId, nativeString, QCAR::Vec2F((float) width, (float) height))) { LOG("Failed to create frame marker."); } LOG("Successfully created frame marker."); env->ReleaseStringUTFChars(markerName, nativeString); } }
JNIEXPORT int JNICALL Java_com_wheelphone_targetNavigation_WheelphoneTargetNavigation_initTracker(JNIEnv *, jobject) { LOG("Java_com_qualcomm_QCARSamples_FrameMarkers_FrameMarkers_initTracker"); // Initialize the marker tracker: QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance(); QCAR::Tracker* trackerBase = trackerManager.initTracker(QCAR::Tracker::MARKER_TRACKER); QCAR::MarkerTracker* markerTracker = static_cast<QCAR::MarkerTracker*>(trackerBase); if (markerTracker == NULL) { LOG("Failed to initialize MarkerTracker."); return 0; } if (!markerTracker->createFrameMarker(0, "MarkerQ", QCAR::Vec2F(50,50))) { LOG("Failed to create frame marker Q."); } if (!markerTracker->createFrameMarker(1, "MarkerC", QCAR::Vec2F(50,50))) { LOG("Failed to create frame marker C."); } if (!markerTracker->createFrameMarker(2, "MarkerA", QCAR::Vec2F(50,50))) { LOG("Failed to create frame marker A."); } if (!markerTracker->createFrameMarker(3, "MarkerR", QCAR::Vec2F(50,50))) { LOG("Failed to create frame marker R."); } LOG("Successfully initialized MarkerTracker."); return 1; }