anyone can help give me example about sequence diagram in imagetarget...i'm so confused...thnk
as harism pointed out, the code in ImageTargets is quite self-explanatory; however these are a few things that can help you understand it better:
first, I assume you know how the Android activity life-cycle works in general (as that's the prerequisite for understanding the workflow of a QCAR application like ImageTargets);
in case you don't fully master that topic, or you wish to refresh it, I recommend a quick reading of:
Also, you should be familiar with the AsyncTask class, as this is a fundamental block and you must understand how it works (although it's very simple).
Then, assuming you are all clear on the above, some main key points about ImageTargets sample (and other Vuforia sample apps as well):
- the updateApplicationStatus() is the key function to look at, as it clearly shows all the transitions from one application status to another (the code is quite self-explanatory)
- starting from the onCreate() method, the app does some general initialization (such as loading textures) and it jumps into APPSTATUS_INIT_APP, where it performs basic initialization steps like setting the screen orientation, storing the screen dimensions, setting up the splashscreen, etc.
- then it continues with QCAR initialization (APPSTATUS_INIT_QCAR): here the important thing to remark is that this phase is delegated to an asynchronous task which runs in a background thread, so that the Activity life-cycle and the GUI thread can continue without being blocked to wait for QCAR initialization to finish
- it is important to understand that the Activity at this point might already move ahead and jump into the onResume() method, while QCAR is perhaps still initializing (and so no OpenGL view is yet available, among other things); this is not a problem, since the onResume() method includes some code to check if the mGLView is null or not (i.e. if it has been created or not);
note that during this time (OpenGL view not available) you will see the Splash screen on your device screen; also check the code "case APPSTATUS_INITED: " and see that the mSplashScreenView is set to invisible when the mGLView is added.
- then, coming back to our asynchronous QCAR initialization, once it is done (see onPostExecute() method), the app status will switch to _INIT_TRACKER, then to _INIT_APP_AR, then to _LOAD_TRACKER;
- the LoadTracker phase is once again asynchronous (using AsyncTask), so, same story as above;
- once the Tracker Loading is done (see onPostExecute method), the app status goes to APPSTATUS_INITED; at this point the OpenGL view is added and the splash screen goes away, then the status switches to _CAMERA_RUNNING
Also, check the onPause and onResume methods to see how the APPSTATUS_CAMERA_RUNNING and APPSTATUS_CAMERA_STOPPED are toggled.
During all of the above, various native functions (C++ JNI) are invoked from Java (you can find them out by yourself).
Last thing: the OpenGL rendering thread is a different thread, so for example, the native function _renderFrame() is called from this thread (check the ImageTaregtsRenderer.java to see what functions are called for OpenGL rendering)
I hope this helps.
Hi, personally I think ImageTargets.updateApplicationStatus(int) -method gives good idea on flow that ImageTargets application follows. Unless I'm mistaken cases in that method are in sequential order you can use as a basis for a sequence diagram. Then looking more deeper into methods called from there gives wider idea on how QCAR works.
Are you sure you want to delete this message?
Are you sure you want to delete this conversation?