"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

AR Project

Hi, I'm new to Android AR project. Would anyone guide me to be familiar with my first AR project? :D I really want to develope an AR app like this myself: [url]http://www.youtube.com/watch?v=plgOQyIim4A[/url] I'm a beginner so that I just want to play some drum sounds when I press the "virtual buttons". I finish all the installation process, can run the sample program on my phone. I have finished reading the dev guide, but I'm still feeling vague of how can I acctually start writting an apps, what should I do next, how can I integrate the C++ code part into my program? Thank you,

For your idea, I would recommend starting with the VirtualButtons sample.

myticmoon

Tue, 01/10/2012 - 14:35

Hi Kim, You said to add this code segment to ImageTargets.cpp, but in Virtual Buttons project.

That was just some sample code to get you started, you'll have to adapt it to your project. Look in VirtualButtons.cpp instead of ImageTargets.cpp. The samples are similar in structure. - Kim

myticmoon

Wed, 01/11/2012 - 15:26

Hi Kim, I have modified the code, but looks like there're some errors. This is the 1st time I dealing with Java Native Interface.

The first thing I see is an incorrect method signature: [CODE] jmethodID method = env->GetMethodID(javaClass, "playSound", "(Ljava/lang/StringV"); [/CODE] Should be: [CODE] jmethodID method = env->GetMethodID(javaClass, "playSound", "(I)V"); [/CODE] (Your method takes an int rather than a String

myticmoon

Fri, 01/13/2012 - 05:55

I have added sound file to the res/raw already. However, it just doesn't work. I'm trying to find out where are the error(s). Thank a lot!

I just noticed that you're adding the playSound method to VirtualButtons.java instead of VirtualButtonsRenderer.java.

myticmoon

Sun, 01/15/2012 - 14:46

Hi Kim, I haven't found where is the errors yet. Just a question, the parameter for this method should be "obj" or "jobject" [QUOTE]jclass javaClass = env->GetObjectClass(obj);[/QUOTE] since in this method [QUOTE]JNIEXPORT void JNICALL Java_com_qualcomm_QCARSamples_VirtualButtons_VirtualButtonsRe

You need to add a variable name for those parameters, e.g. [CODE] Java_com_qualcomm_QCARSamples_VirtualButtons_Virtu alButtonsRenderer_renderFrame(JNIEnv* env, jobject obj) [/CODE] - Kim

myticmoon

Tue, 01/17/2012 - 07:20

Hi, I have just upgraded my phone to IceCream SandWich and recognized that Qualcomm AR doesn't support ICS. Even though I really enjoy ICS, I have to flash 2.3.4 ROM to my phone again. T.T I use debugger on Eclipse I find out that the playSound method is never called by the native code.

myticmoon

Tue, 01/17/2012 - 16:18

Hi Kim, Could you check for the whether this code is correct or not? [QUOTE]jclass javaClass = (*env)->GetObjectClass(obj); //changed from obj to jobject jmethodID method = (*env)->GetMethodID(javaClass, "playDrumSound", "(I)V"); //method is playSound method in Java al

Hmm, why are you dereferencing the env pointer now? Try using "env" instead of "(*env)". - Kim

myticmoon

Wed, 01/18/2012 - 16:35

These are the errors log when I tried ndk-build after modifying the native code. Still can't find out the error so far.

Variable declaration order matters in C/C++. If you're using the code snippet I provided earlier, make sure this line comes after the NUM_BUTTONS global variable is defined: [CODE] const int NUM_BUTTONS = 4; bool buttonPressed[NUM_BUTTONS]; [/CODE] - Kim

myticmoon

Thu, 01/19/2012 - 08:07

I see, have just fixed that problem [QUOTE] for (int j = 0; j < NUM_BUTTONS; ++j) { if (strcmp(button->getName(), virtualButtonColors[j]) == 0) { if (button->isPressed()) { if (!buttonPressed[j]) {

myticmoon

Thu, 01/19/2012 - 09:01

OOps, look like program can run. However, the program only plays drum sound when I press "Blue Button", for the others, the program stops unexpectedly.:confused::confused::confused::confused:

Don't initialize your sounds every time playDrumSound is called (that's what your earlier code seemed to be doing). Check the bounds of your sound array to make sure it has an element for the given id. - Kim

myticmoon

Tue, 01/31/2012 - 06:32

Hi Kim, Now the program run smoothly, I intend to improve my program a bit but I have to ask you about the possibility first! Can I use Frame Marker as a virtual button?

No, virtual buttons only work with Image Targets. Sorry! - Kim

myticmoon

Wed, 02/01/2012 - 08:14

Hi Kim, Thank for ur response! Is there any way to get around that? can I introduce an timer to detect an event that the frame marker is currently on the screen but disappears for 0.5 sec ( or shorter duration ) ?

Sure, you have all of the information you need to do that. Just keep track of which markers are visible each frame. When a marker goes from active to lost record the time. When it is found again compare the current time with the recorded lost time. - Kim