By LwaziPrusent
on Fri, 02/15/2013 - 12:27
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 :)
Anumation Problem
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;
Anumation Problem
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,
Anumation Problem
Hi, I have placed the animation code just before the "for loop"; can you try the same ?
Anumation Problem
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
Anumation Problem
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
Anumation Problem
Great.