Hi I can change teapot to different object. I used banana model which is include in http://heikobehrens.net/2009/08/27/obj2opengl/ examples.
Firstly I changed ImageTargets.java and I add
mTextures.add(Texture.loadTextureFromApk("banana.png", getAssets()));
in loadTextures() and add banana.png in assets folder.
After that I changed ImageTargets.cpp like this:
// 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]);
glDrawElements(GL_TRIANGLES, NUM_TEAPOT_OBJECT_INDEX, GL_UNSIGNED_SHORT,
(const GLvoid*) &teapotIndices[0]);
to
// Draw object:
glBindTexture(GL_TEXTURE_2D, thisTexture->mTextureID);
glVertexPointer(3, GL_FLOAT, 0, bananaVerts);
glNormalPointer(GL_FLOAT, 0, bananaNormals);
glTexCoordPointer(2, GL_FLOAT, 0, bananaTexCoords);
glDrawArrays(GL_TRIANGLES, 0, bananaNumVerts);
Also;
glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0,(const GLvoid*) &teapotVertices[0]);
glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &teapotNormals[0]);
glVertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &teapotTexCoords[0]);
glDrawElements(GL_TRIANGLES, NUM_TEAPOT_OBJECT_INDEX, GL_UNSIGNED_SHORT, (const GLvoid*) &teapotIndices[0]);
to
glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0,(const GLvoid*) &bananaVerts[0]);
glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0,(const GLvoid*) &bananaNormals[0]);
glVertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 0,(const GLvoid*) &bananaTexCoords[0]);
glDrawArrays(GL_TRIANGLES, 0, bananaNumVerts);
It works correctly thanks for help AllessendroB. Only problem is,banana is shown in phone screen very high to marker. But its ready model and banana.h includes vertices, textcoordinates and normals. I create 3d model in blender and export .obj format. After that convert it with obj2opengl.pl myobject.obj code in cmd. It create myobject.h but it has not texture. ıt has only normals and vertices. Also I have not myobject.png. I guess for import 3d model to imageTargets projects I should have to. How can i solve this problem? By the way I really thank you for your help. I know I'm beginner and do something not easily but you help me everytime. Thankyou
link is broken
kindly help