Log in or register to post comments

can't replacing teapot problem !!

March 20, 2012 - 11:34am #1

according to this thread


i deleted the teapot header and replaced it with plane header and included it instead of teapot in plane!! and still teapot appear instead of the blank plane !!

 // Did we find any trackables this frame?
    for(int tIdx = 0; tIdx < state.getNumActiveTrackables(); tIdx++)
        // Get the trackable:
        const QCAR::Trackable* trackable = state.getActiveTrackable(tIdx);
        QCAR::Matrix44F modelViewMatrix =

        // Choose the texture based on the target name:
        //int textureIndex = (!strcmp(trackable->getName(), "stones")) ? 0 : 1;
        //const Texture* const thisTexture = textures[textureIndex];
        const Texture* const imgTexture = textures[2];
#ifdef USE_OPENGL_ES_1_1
        // Load projection matrix:

        // Load model view matrix:
        glTranslatef(0.f, 0.f, kObjectScale);
        glScalef(kObjectScale, kObjectScale, kObjectScale);

        // Draw object:
        glBindTexture(GL_TEXTURE_2D, thisTexture->mTextureID);
        glTexCoordPointer(2, GL_FLOAT, 0, (const GLvoid*) &teapotTexCoords[0]);
        glVertexPointer(3, GL_FLOAT, 0, (const GLvoid*) &teapotVertices[0]);
        glNormalPointer(GL_FLOAT, 0,  (const GLvoid*) &teapotNormals[0]);
                       (const GLvoid*) &teapotIndices[0]);

        QCAR::Matrix44F modelViewProjection;

        SampleUtils::translatePoseMatrix(0.0f, 0.0f, kObjectScale,
        SampleUtils::scalePoseMatrix(target_size.data[0], target_size.data[1], 1.0f,
                                    &modelViewMatrix.data[0] ,

        glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0,
                              (const GLvoid*) &planeVertices[0]);
        glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0,
                              (const GLvoid*) &planeNormals[0]);
        glVertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 0,
                              (const GLvoid*) &planeTexCoords[0]);
        glBindTexture(GL_TEXTURE_2D, imgTexture->mTextureID);
        glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE,
                           (GLfloat*)&modelViewProjection.data[0] );
        glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT,
                       (const GLvoid*) &planeIndices[0]);

        SampleUtils::checkGlError("ImageTargets renderFrame");

Re: can't replacing teapot problem !!

March 27, 2012 - 6:35pm #8

Did you define it as planeTexcoords instead of planeTexCoords?

static const float planeTexcoords[] =
    0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0

Make sure the variable names match, of course!

- Kim

Re: can't replacing teapot problem !!

March 27, 2012 - 4:53am #7

tawheed@tawheed-PC /cygdrive/c/Android/qcar-android-1-0-6/samples/ImageTargets/jni
$ ndk-build
Gdbserver      : [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver
Gdbsetup       : libs/armeabi/gdb.setup
Gdbserver      : [arm-linux-androideabi-4.4.3] libs/armeabi-v7a/gdbserver
Gdbsetup       : libs/armeabi-v7a/gdb.setup
Compile++ arm    : ImageTargets <= ImageTargets.cpp
C:/Android/qcar-android-1-0-6/samples/ImageTargets/jni/ImageTargets.cpp: In function 'void Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargetsRenderer_renderFrame(JNIEnv*, _jobject*)':
C:/Android/qcar-android-1-0-6/samples/ImageTargets/jni/ImageTargets.cpp:177: error: 'planeTexCoords' was not declared in this scope
make: *** [/cygdrive/c/Android/qcar-android-1-0-6/samples/ImageTargets/obj/local/armeabi/objs-debug/ImageTargets/ImageTargets.o] Error 1

that's what i get it , it is ok with all the header attributes except for the planeTexCoords !!

Re: can't replacing teapot problem !!

March 26, 2012 - 10:18pm #6

Just run "ndk-build", you don't need to pass it an argument. Does that help?

- Kim

Re: can't replacing teapot problem !!

March 26, 2012 - 5:49am #5

when tried to integrate the eclipse builder so as not always to refer to cygwin it gave men this error !!:

Errors occurred during the build.
Errors running builder 'Integrated External Tool Builder' on project 'ImageTargets'.
Exception occurred executing command line.
Cannot run program "C:Androidandroid-ndk-r7ndk-build" (in directory "C:Androidqcar-android-1-0-6samplesImageTargets"): CreateProcess error=193, %1 is not a valid Win32 application
Exception occurred executing command line.
Cannot run program "C:Androidandroid-ndk-r7ndk-build" (in directory "C:Androidqcar-android-1-0-6samplesImageTargets"): CreateProcess error=193, %1 is not a valid Win32 application

and when tried building with the cygwin terminal it gave me that PlaneTexCoords are not defined in the scope as it read the rest of the header file and and don't read this !!! it's strange , then now

tawheed@tawheed-PC /cygdrive/c/Android/qcar-android-1-0-6/samples/ImageTargets/jni
$ ndk-build ImageTargets.cpp
make: Nothing to be done for `ImageTargets.cpp'.

it getting more tough plz help

Re: can't replacing teapot problem !!

March 21, 2012 - 6:57pm #4

Can you add a log line to the renderFrame method and see it in the log? It sounds like your changes aren't taking effect. Something like this:

LOG("Here I am in the renderFrame method.");

That will at least confirm if you're building the .so correctly and if Eclipse is picking it up. You can see the log in the DDMS perspective in Eclipse.

You may also want to try running "ndk-build -B" to force a rebuild of the native code.

- Kim

Re: can't replacing teapot problem !!

March 21, 2012 - 6:40am #3

i tried it on imagetargets and the same project but changing the trackable with adding the data and every thing ,, but both the same ,,,,i even deleted the teapot.h file and still displayed!!

Re: can't replacing teapot problem !!

March 20, 2012 - 6:39pm #2

Did you rebuild the .so using ndk-build? You'll also want to refresh or clean the Eclipse project after running ndk-build.

- Kim

Log in or register to post comments