"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

Anumation Problem

Hello everyone

Im trying to create a simple animation on the image target sample, so I added

float x = 0.0f;
float y = 0.0f;
bool moveRight = true;

under the

static float kObjectScale = 3.0f;

I then

in the "JNIEXPORT void JNICALLJava_com_qualcomm_QCARSamples_ImageTargets_ImageTargetsRenderer_renderFrame(JNIEnv *, jobject)" function (which i assume draws the scean)

i added

        if (moveRight == true) {
          x += 1.0f;
            if (x > 50.0f)
                moveRight = false;
         }
         else {
          x -= 1.0f;
            if (x < -50.0f)
                moveRight = true;
         }

then changed

glTranslatef(0.0f, 0.0f, kObjectScale);

to

glTranslatef(x, y, kObjectScale);

and changed

SampleUtils::translatePoseMatrix(0.0f, 0.0f, kObjectScale,
                                         &modelViewMatrix.data[0]);

to

SampleUtils::translatePoseMatrix(x, y, kObjectScale,
                                         &modelViewMatrix.data[0]);

but nothing happens even if i just put

x = 50.0f

in renderFrame, the only time I get a result is when I change the value where the variable is created (ie float x = 30.0f)

please help

I tried to make this as clear as possible to make it easier to understand my problem.

Thanks In Advance :)

AlessandroB

Fri, 02/15/2013 - 13:47

Hi, I just tried your code changes in the Image Targets sample and it works nicely (I can see the teapot oscillating on the target, moving left-to-right and back right-to-left).

Not sure what the problem could be in your case;

LwaziPrusent

Fri, 02/15/2013 - 16:12

thank u for the reply, yes I am doing the ndk-build and refreshing the project but it does not work mabey I'm placing it in the wrong place, 

LwaziPrusent

Sun, 02/17/2013 - 06:07

Once again thanks for the reply I realise now that I was being stupid I place my loop in an if statement for another version of opengl so it never 

LwaziPrusent

Sun, 02/17/2013 - 06:08

Once again thanks for the reply I realise now that I was being stupid I place my loop in an if statement for another version of opengl so it never got&n