Log in or register to post comments

Change the model

June 12, 2012 - 10:31pm #1

Hi, i want to create one pop up window, and also write onclick(), for that, Anybody help me for my problem.

Change the model

July 8, 2012 - 8:16pm #10

Hi Peter!

 

Thank you for your reply. As you said, I already done that a couple of times already. I've been doing that ever since.

I also removed the teapot.h and the syntax #include "Teapot.h" so that there will be no more teapot to show. BUT still, the shape 

of the model is still the shape of the teapot. :(

Change the model

July 6, 2012 - 1:08pm #9

Hello,

Please make sure to run ndk-build to compile the native code before running your poject on the device. Also clean your project before bulding it again in eclipse.

Thank you,

-Peter

Change the model

July 6, 2012 - 12:02am #8

Hi! I hope someone help me. I did the instructions as what stated here. But unlike most of you, my result was not as expected. My result was still a teapot but with the texture of the banana. I don't know what went wrong. I hope someone help me. Thank you.

Change the model

June 20, 2012 - 10:43pm #7

Thanks for your response Peter, 

                how to checkout whether found trackables is zero or something else(i.e. not zero). Also if the pattern matches  something should be show which is better, either showing dialog box nor popup window.

Change the model

June 20, 2012 - 4:01pm #6

Hello Check,

I see you used the display a toast example however you are showing a dialog instead of a toast. The toast was set with a default length. In your code your dialog will not go away because there is no event to trigger it going away. You can do a check to see if there are zero trackables found in the c++ code and then call a java function to hide the dialog.

Thank you,

-Peter

Re: Change the model

June 19, 2012 - 10:20pm #5

Hi Peter,

Here i attached the code which i modified.,
In ImageTarget.cpp

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();

glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);

// Did we find any trackables this frame?
for(int tIdx = 0; 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();
}
QCAR::Renderer::getInstance().end();

}
}
In ImageTargeRedender.java
public void displayMessage(String text)
{
// We use a handler because this thread cannot change the UI
Message message = new Message();
message.obj = text;
mainActivityHandler.sendMessage(message);
}

In ImageTarget.java
OnResume method

ImageTargetsRenderer.mainActivityHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
String text = (String) msg.obj;
// The Toast display the name of the detected trackable on the screen
Context context = getApplicationContext();
int duration = Toast.LENGTH_SHORT;
// Toast toast = Toast.makeText(context, text, duration);
// toast.show();

// The following opens a pre-defined URL based on the name of trackable detected
if (text.equalsIgnoreCase("stones"))
{

dialog = new Dialog(ImageTargets.this);
dialog.setContentView(R.layout.main);

button = (ImageView) dialog.findViewById(R.id.imageView1);
dialog.show();

} } }; }

In the above the code, the custom image is show on the screen, when the marker is move away..,help me to solve the problem..,

Re: Change the model

June 19, 2012 - 12:08pm #4

Hello check,

Can you post the code from your renderframe function in ImageTargets.cpp ? Does the augmentation go away when you move away from the marker or is it staying on screen?

In Our sample app in ImageTargets.cpp in the renderFrame function notice the for loop under the comment "//Did we find any trackables this frame?" This is where we render if a target is detected. Then notice how we swap textures based on the trackable found. If you want separate augmentations you can edit this portion to render different augmentations based on the trackable found.

Thank you,

-Peter

Re: Change the model

June 19, 2012 - 3:41am #3

I have changed the teapot in to custom image, it works properly but it will not disappear when it show in to the other objects.

Re: Change the model

June 13, 2012 - 10:21am #2

Hello check,

Please see the ImageTargets sample application for an example of creating a menu. In the sample app the menu is accessed by the Menu button on the Android phone however you can change this. The menu responds to user presses on items in the menu.

please let me know if you have questions about the code after looking at the ImageTargets sample application.

Thank you,

-Peter

Log in or register to post comments