JNIEXPORT jboolean JNICALL JNIFUNCTION_NATIVE(nativeDestroy(JNIEnv * env, jobject object)) { LOGD("nativeDestroy\n"); VirtualEnvironmentFinal(); DeleteMarkers(&g_pMarkersNFT, &g_nMarkersNFTCount); return (true); }
// // This is called whenever the OpenGL context has just been created or re-created. // Note that GLSurfaceView is a bit asymmetrical here; we don't get a call when the // OpenGL context is about to be deleted, it's just whipped out from under us. So it's // possible that when we enter this function, we're actually resuming after such an // event. What about resources we allocated previously which we didn't get time to // de-allocate? Well, we don't have to worry about the OpenGL resources themselves, they // were deleted along with the context. But, we should clean up any data structures we // allocated with malloc etc. ARGL's settings falls into this category. // JNIEXPORT void JNICALL JNIFUNCTION_NATIVE(nativeSurfaceCreated(JNIEnv* env, jobject object)) { #ifdef DEBUG LOGI("nativeSurfaceCreated\n"); #endif glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glStateCacheFlush(); // Make sure we don't hold outdated OpenGL state. if (gArglSettings) { arglCleanup(gArglSettings); // Clean up any left-over ARGL data. gArglSettings = NULL; } VirtualEnvironmentFinal(); // Clean up any left-over OSG data. gARViewInited = false; }
static void cleanup(void) { VirtualEnvironmentFinal(); if (markersNFT) deleteMarkers(&markersNFT, &markersNFTCount); // NFT cleanup. unloadNFTData(); ARLOGd("Cleaning up ARToolKit NFT handles.\n"); ar2DeleteHandle(&ar2Handle); kpmDeleteHandle(&kpmHandle); arParamLTFree(&gCparamLT); // OpenGL cleanup. arglCleanup(gArglSettings); gArglSettings = NULL; // Camera cleanup. arVideoCapStop(); arVideoClose(); }
static void cleanup(void) { VirtualEnvironmentFinal(); if (markersSquare) deleteMarkers(&markersSquare, &markersSquareCount, gARPattHandle); // Tracking cleanup. if (gARPattHandle) { arPattDetach(gARHandle); arPattDeleteHandle(gARPattHandle); } ar3DDeleteHandle(&gAR3DHandle); arDeleteHandle(gARHandle); arParamLTFree(&gCparamLT); // OpenGL cleanup. arglCleanup(gArglSettings); gArglSettings = NULL; // Camera cleanup. arVideoCapStop(); arVideoClose(); }