Log in or register to post comments

could I use JPG or others 2D-picture to replace 3D object ?

June 27, 2012 - 10:57pm #1

Hi All,

 

   As Kim said the post could help me, but I could not open the page, who can help me?

https://ar.qualcomm.at/arforums/showpost.php?p=1596

 

 

could I use JPG or others 2D-picture to replace 3D object ?

September 16, 2015 - 4:57pm #48

Hi, there

I solved my cast problem with this code        

 

const QCAR::ImageTarget& imageTarget = (const QCAR::ImageTarget&)result->getTrackable();

HTH

Navin

 

could I use JPG or others 2D-picture to replace 3D object ?

April 4, 2015 - 12:46pm #47

I have the same cast problem. Please help!

could I use JPG or others 2D-picture to replace 3D object ?

March 30, 2015 - 1:36pm #46

Hi,

I am a beginner started to work on drawing 2d image on target using openGL but I have faced the same error like discussed below. I have followed the instructions in the link: https://developer.vuforia.com/library/articles/Solution/How-To-Draw-a-2D-image-on-top-of-a-target-using-OpenGL-ES . It shows me the same casting error. What should I do to display 2d picture or texture on my Image Target.

Any advice or link to solve problem would be so helpfull. I appreciate for your support. 

 

could I use JPG or others 2D-picture to replace 3D object ?

April 25, 2014 - 4:11am #45

Check this updated version:

https://developer.vuforia.com/resources/dev-guide/replacing-teapot

This contains correct C++ code, as well as Java code if you use the Java API.

 

could I use JPG or others 2D-picture to replace 3D object ?

April 25, 2014 - 2:31am #44

hi ,

 i facing the problem like below when i compile the image target .cpp on the cygwin terminal .i modified the coding  by follow ur instruction .i m not sure which part i have done wrong .

 
$ ndk-build
[armeabi-v7a] Compile++ arm  : ImageTargetsNative <= ImageTargets.cpp
jni/ImageTargets.cpp: In function 'void Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargetsRenderer_renderFrame(JNIEnv*, jobject)':
jni/ImageTargets.cpp:418:50: error: invalid cast from type 'const QCAR::Trackable' to type 'QCAR::ImageTarget*'
/cygdrive/c/Users/leo/Desktop/android/android-ndk-r9d/build/core/build-binary.mk:393: recipe for target 'obj/local/armeabi-v7a/objs/ImageTargetsNative/ImageTargets.o' failed
make: *** [obj/local/armeabi-v7a/objs/ImageTargetsNative/ImageTargets.o] Error 1
 
 
thank for the help:

could I use JPG or others 2D-picture to replace 3D object ?

April 18, 2014 - 1:49am #43

That article refers to C++ and JNI folder because it refers to the Android C++ native sample code (see the ImageTargetsNative sample in Vuforia 2.8).

It does not apply to Unity; in Unity, this is a task that can be really done by following the Unity developer guide... and this is not so relevant to Vuforia per-se.

 

 

could I use JPG or others 2D-picture to replace 3D object ?

April 16, 2014 - 3:23am #42

hi Allesandro B ,

can i ask another question if i want to modify using vuforia by following  this link :https://developer.vuforia.com/resources/dev-guide/textured-plane-target

but i saw that the sample is guide us in modify the c++ code in jni folder but i didnt see any c file there ..so where i can change the planes vertices ...

 

thank uu:)

 

could I use JPG or others 2D-picture to replace 3D object ?

April 16, 2014 - 1:37am #41

...i cant find any instruction on that .

Probably because replacing a model with another in Unity (even if you do it with an image target as parent object) is a basic Unity programming/editor topic, not a Vuforia-specific subject.

 

could I use JPG or others 2D-picture to replace 3D object ?

April 16, 2014 - 1:26am #40

hi ,can i know that can i use jpg or 2D model to replace 3Dmodel in image target  by using unity 3d ?i cant find any instruction on that .

could I use JPG or others 2D-picture to replace 3D object ?

March 5, 2013 - 2:48am #39

Glad to hear that you solved it :-)

More in general, if you still meet similar issues, please check the migration guide (to port code from 1.5 to 2.0):

https://developer.vuforia.com/resources/dev-guide/migrating-your-android-sdk-project

 

Same error

March 5, 2013 - 2:39am #38

I have the same error as Mita.

I did what Kim said on this forum post nr 3:

https://developer.vuforia.com/forum/qcar-api/understanding-getpose-function

But when i compile it with NDK i get a invalid cast error from QCAR Trackable to QCAR imageTarget.

I'm using Vuforia SDK 2.0

Can someone help me?

Best Regards.

I solved it:

Solution:

QCAR::Vec2F targetSize = (( QCAR::ImageTarget *) &trackable)->getSize();

 

Hi Mita, thanks for the link

December 24, 2012 - 1:54am #37

Hi Mita, thanks for the link to your source code;

I downloaded it, but it actually looks like some code with some JS functions;

could you double check that the ImageTargets.cpp contains the right piece of code ?

Otherwise you can also copy-paste here the relevant code snippet that fails to compile, so I can verify it.

Thanks.

One question: are you using Vuforia 1.5 or 2.0 at the moment ?

 

Error in 2d image used in image target

December 23, 2012 - 10:25pm #36

hi AlessandroB,

 

Thanks for guidance

 

I had added plan coordinates on top of the ImageTarget.cpp.

 

You can find that file from

https://www.dropbox.com/sh/1665izr0v9tnf89/1pDFGyn75D

 

I had follow all the step used for 2d image in image target

But when I compile the code with ndk-build it will give following error.

invalid cast from type 'const QCAR::Trackable' to type 'QCAR: :ImageTarget*'

 

Please guide

Thanks & Regards

Mita

 

 

Hi, have you tried including

December 23, 2012 - 7:35am #35

Hi, have you tried including the ImageTarget.h header ?

 

#include <QCAR/Trackable.h>

#include <QCAR/ImageTarget.h>

For the texPlaneCoords, that is just an example, but you need to define by yourself a simple rectangular geom with texture coordinates

to render the picture on top of it. 

I hope this helps.

 

 

error in 2d image instead of 3d object

December 23, 2012 - 12:56am #34

Hello AlessandroB

 

Thanks for suggestion,

now I have  decided to use 2d picture instead of 3d object, but when I using the code given in below link

https://developer.vuforia.com/forum/android/could-i-use-jpg-or-others-2d-picture-replace-3d-object#comment-2013355

It will give following error,

jni/ImageTargets.cpp: In function 'void

Java_com_qualcomm_QCARSamples_ImageTarge                                                                                                                          

ts_ImageTargetsRenderer_renderFrame(JNIEnv*, jobject)':

 invalid cast from type 'const QCAR::Trackable' to type 'QCAR::ImageTarget*'

'planeTexCoords' was not declared in this scope

 

Please guide,

Thanks & regards

mita

Hi, the suggested code and

December 22, 2012 - 9:21am #33

Hi, the suggested code and technique to display the model in OpenGL is correct in general,

however, for complex models it can happen that the model is not exported in a fully correct way using the conversion tool (we have seen this kind of issues also with other models in the past);

in such a case, honestly using a game engine like Unity is a much better option;

for the license you can check on the Unity3D website, as they have multiple license schemes.

 

 

3d Object not display properly

December 21, 2012 - 10:10pm #32

Hello AlessandroB

Thanks for your quick reply, I change accordingly but it not looks good. I have doubt that is this a right way to display object or there is another way? Can u please advice which is the better for my requirement, can I have to use unity 3d to display 3d object? Is it free for commercial purpose? Or simply use jpg image instead of 3d object?

I tried to put 2d image. I followed the guide line given in below link

https://developer.vuforia.com/forum/android/could-i-use-jpg-or-others-2d-picture-replace-3d-object#comment-2013355

But gives error

 

jni/ImageTargets.cpp: In function 'void

Java_com_qualcomm_QCARSamples_ImageTarge                                                                                                                          

ts_ImageTargetsRenderer_renderFrame(JNIEnv*, jobject)':

 invalid cast from type 'const QCAR::Trackable' to type 'QCAR::ImageTarget*'

'planeTexCoords' was not declared in this scope

 

What can I do?  Please guide

Thanks & regards

Mita

 

 

 

 

Hi Mita, I have tested your

December 21, 2012 - 7:03am #31

Hi Mita,

I have tested your teapot.h (house model) and I checked your code in ImageTargets.cpp:

actually one of the problems is that about 50% of the triangles of the 3D model are culled away by OpenGL, so you only see half of the triangles (and you see holes for the missing ones);

to avoid this, you need to disable the OpenGL face culling right before calling glDrawArrays() and then re-enable it back after the draw call, i.e. your draw code should be modified as follows:

 

    glDisable(GL_CULL_FACE);
 
    glDrawArrays(GL_TRIANGLES, 0, NUM_TEAPOT_OBJECT_VERTEX);
 
    glEnable(GL_CULL_FACE);
 
(Note the "glDisable(GL_CULL_FACE)" and "glEnable(GL_CULL_FACE)" added before and after glDrawArrays())
 
This should already lead to a much better visual result (as I just verified by testing it);
 
note however that the house model does not seem to be completely perfect, and I seem to see still a few weird triangles (in particular on some of the windows and/or doors of the house model you can see some unwanted triangles);
that seems to be rather a problem with the OpenGL conversion tool, or the OBJ model itself perhaps.
 
I hope this helps.
 

Hi Mita, I have downloaded

December 21, 2012 - 5:55am #30

Hi Mita, I have downloaded your files, I'm going to take a look;

A side note: you may now want to change your dropbox password, which you published in your message (this is a public Forum).

 

3D Object not display properly

December 20, 2012 - 11:21pm #29

Hello,

Thanks for your continuous support

I had created sample application for 3d Augmentation of house view. now my problem is 3d object not create properly and blinking when camera focus on target image.

i have put  my code in dropbox.

dropbox information

Email Id :mita.vaghela@gmail.com

password:mita3183

https://www.dropbox.com/home/3D%20Augmentation

 

here house.jpg is how 3d house will display.

image001.jpg is target image on which 3d house will display

ImageTargets.cpp for object settings

Teapot.h header file for house

houseF.obj object file for house.

 

kindly review the code and guide for the same.

 

thanks & Regards

Mita

 

Hi Mita, if the size of your

December 20, 2012 - 3:02am #28

Hi Mita,

if the size of your header file is too big to be handled by Eclipse, this is a clear indication that you should not use such a mesh;

even if you manage at some point to get  Eclipse to pick up (without hanging) and compile your large header file, probably your Android device will not be able to render it, due to:

- memory constraints

- OpenGL-ES limitations in the size of the mesh that can be rendered (consider that the size of a vertex array cannot exceed 65,000 vertices/indices; so you should then split your mesh into several vertex arrays, each one containing less than 65,000 vertices)

What I would suggest is to first make a simnpler test by integrating relatively small 3D models (low polygon count), and if you are successfull with that, then you could verify if larger models work (maybe proceeding incrementally with 3 or 4 models of different sizes).

 

.h file is to big gives error

December 19, 2012 - 10:48pm #27

hello,

my app has very large .h file.so it can't inserted in my apps please guide how can i add this .h file to application

when i add this .h file eclipse hanged out and closed.

 

please guide

thanks & regards

mita

 

 

Hi, I just relaized that the

December 19, 2012 - 6:06am #26

Hi, I just relaized that the private message feature is temporarily unavailable;

could you maybe put your files in a DropBox location (or similar) from which I can dowload them ?

 

using model

December 19, 2012 - 5:57am #25

Hello,

can you please give PM info. i  can not find contact info.

 

thanks & regards

mita

Hi, about using the model

December 19, 2012 - 1:15am #24

Hi,

about using the model without textures:

yes, it is possible, just remove (or comment out) these lines of code in the _renderFrame function in ImageTargets.cpp:

       glBindTexture(GL_TEXTURE_2D, .... );

       glUniform1i(texSampler2DHandle, 0 /*GL_TEXTURE0*/); 

Then, in the shader (see CubeShader.h ) you need to change this line:

gl_FragColor = texture2D(texSampler2D, texCoord); 

replace it with:

gl_FragColor = vec4 (1.0, 1.0, 1.0, 1.0); //Note: (1.0, 1.0, 1.0, 1.0) is white color, => use your desired R,G,B,A values to get the color that you want

For your other question:

could you PM me the header file (.h) of your model, so that I can have a look and try to render it ?

How to change teapot to another object

December 18, 2012 - 8:37pm #23

Hello,

Thanks for reply,

I want to develop apps in that there is one house construction plan on paper and by this apps it will show 3d view of that house.

but when i generate 3d view with skechup and create .obj file with blender and convert in to .h file and use in my apps.the 3d object which is display is not showing properly and  is it posible to use object with out texture?

please guide.

Thanks & Regards

Mita

 

 

 

 

Hi Mita, have you followed

December 18, 2012 - 7:16am #22

Hi Mita,

have you followed the process described in this thread:

https://developer.vuforia.com/forum/faq/android-how-do-i-replace-teapot

?

Also, you may want to check in the FAQs section for other possible discussions related to this topic:

https://developer.vuforia.com/forum/faq/

If, after reading the above, you still have questions on the OBJ integration, you can post it here (but please try to describe your problem with sufficient detail, so that we can help effectively).

 

 

 

 

Replacing TeaPot to 3d object

December 18, 2012 - 6:20am #21

Hello,

I am using ImageTarget example for 3d augmention.

My requirement is to i have to create app like there is structure of house.and by app it shows house 3d view.

i have create .obj file of house. but it will not display currectly.i also have problem with its texture.

please guide

 

Thanks & Regards

Mita

 

could I use JPG or others 2D-picture to replace 3D object ?

August 21, 2012 - 2:38am #20

Could you help me?

could I use JPG or others 2D-picture to replace 3D object ?

August 17, 2012 - 2:35am #19

OK, I sent you the code and the texture.

could I use JPG or others 2D-picture to replace 3D object ?

August 15, 2012 - 8:33am #18

Can you post the code that you're using and the texture? - you can PM the texture to me if you would prefer.

could I use JPG or others 2D-picture to replace 3D object ?

August 15, 2012 - 2:51am #17

I've read my post again and maybe it's confusing. The problem is not that the texture doesn't reder well, what isn't working well is the plane which must be reder over the trackable, the 2d plane which is replacing the 3d object.

I need only that to complet my project. could you help me?

Thanks

could I use JPG or others 2D-picture to replace 3D object ?

August 9, 2012 - 8:41am #16

Hi again.

That have 3 of 5 stars. The trackable is recognised with distance but the 3d plane isn't rendered.

Thanks.

could I use JPG or others 2D-picture to replace 3D object ?

August 8, 2012 - 3:36pm #15

What is the rating of your target by the TMS (i.e. how many stars )?

There shouldn't be any difference in the texture rendering by changing the target.

could I use JPG or others 2D-picture to replace 3D object ?

August 1, 2012 - 8:59am #14

Ok. It's fixed the problem in the sample trackable I could see the image. Now I know that the image have to be 2x in width and height. But, on the other hand, when I tried with my trackable it isn't fixed and the 2d plane(in black) only appear when I'm closed to the image and not with some distance, I will tried to upload a screen capture.

Here it is. I put the camera in angle to see how in the nearest part of the trackabale (a Velazquez picture) we can see the plane built in black but in the farest part the plane isn't built.

http://www.freeimagehosting.net/newuploads/rpaqr.png

Thanks.

could I use JPG or others 2D-picture to replace 3D object ?

July 31, 2012 - 11:56am #13

The other thing to determine is whether your device supports non-power-of-two (NPOT) textures, and if not to ensure that the width and height of the image are both a power of two (ie. 2,4,8,16,32,64,...).

could I use JPG or others 2D-picture to replace 3D object ?

July 31, 2012 - 10:35am #12

Can you post the image? And is this occuring w/ all other png's, or just this one?

could I use JPG or others 2D-picture to replace 3D object ?

July 31, 2012 - 3:11am #11

Yes, the picture is in asset folder and I call with the correcto number. I only change what I wrote down.

could I use JPG or others 2D-picture to replace 3D object ?

July 30, 2012 - 10:05am #10

Is this picture in the /assets folder?

And you are using the correct texture index the C++ file?

    private void loadTextures()
    {

       // textures[0]
        mTextures.add(Texture.loadTextureFromApk("TextureTeapotBrass.png",
                                                 getAssets()));

        // textures[1]
        mTextures.add(Texture.loadTextureFromApk("TextureTeapotBlue.png",
                                                 getAssets()));

       // textures[2]
        mTextures.add(Texture.loadTextureFromApk("TextureTeapotRed.png",
                getAssets()));       
    }

could I use JPG or others 2D-picture to replace 3D object ?

July 30, 2012 - 9:54am #9

Hi, I did what you say and I was able to see the teapot png picture in the plane but if the the loadTexture method I change that file for any other .png file the plane looks black.

I only change:

Quote:

mTextures.add(Texture.loadTextureFromApk("TextureTeapotBlue.png",getAssets()));

for this other line whre Awesome.png is a random picture from the internet:

Quote:

mTextures.add(Texture.loadTextureFromApk("Awesome.png", getAssets()));

 

Thanks

could I use JPG or others 2D-picture to replace 3D object ?

July 27, 2012 - 10:56pm #8

I'm really appreciated. It works. The problem is the size of the picture.

Anyone who notice what I'm saying please don't make the same mistake as I do.

could I use JPG or others 2D-picture to replace 3D object ?

July 13, 2012 - 5:13pm #7

Can you post your renderFrame code? Also be sure that you're adding the texture that you want to use.

  1. Add the texture images to the assets folder.
  2. In the main activity class (e.g. ImageTargets.java) find the loadTextures() method. Add additional calls to mTextures.add for each of your image files. Note that the order in which the textures are added determines their order in the native texture array.
  3. In the native renderFrame() method (e.g. in ImageTargets.cpp) find the point at which the texture object is obtained (textures[textureIndex]). Change the texture index to select the desired texture. The indices start at 0, where index 0 is the first texture added in the loadTextures() Java method.

could I use JPG or others 2D-picture to replace 3D object ?

July 13, 2012 - 4:54pm #6

hi thanks for the instruction above and I've tried it in the ImageTargets sample, it does succeed but unfortunately, only shows up a black pic.

however, the teapot shows up too but the sharp is strange and not fully visiable seems been stretched.

Please help me. Now Im livin' hell...

could I use JPG or others 2D-picture to replace 3D object ?

June 30, 2012 - 11:44pm #5

you should mark the source code and replace like this:

quote :-----------------------------------------------------------------------------------------------------------------------

/*
        QCAR::Matrix44F modelViewProjection;

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

        glUseProgram(shaderProgramID);
        
        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]);
       
        glEnableVertexAttribArray(vertexHandle);
        glEnableVertexAttribArray(normalHandle);
        glEnableVertexAttribArray(textureCoordHandle);
       
        glActiveTexture(GL_TEXTURE0);
        glBindTexture(GL_TEXTURE_2D, thisTexture->mTextureID);
        glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE,
                           (GLfloat*)&modelViewProjection.data[0] );
        glDrawElements(GL_TRIANGLES, NUM_TEAPOT_OBJECT_INDEX, GL_UNSIGNED_SHORT,
                       (const GLvoid*) &teapotIndices[0]);
       */
       QCAR::Vec2F targetSize = ((QCAR::ImageTarget *) trackable)->getSize();

       QCAR::Matrix44F modelViewProjection;
      
       SampleUtils::translatePoseMatrix(0.0f, 0.0f, kObjectScale, &modelViewMatrix.data[0]);
      
       SampleUtils::scalePoseMatrix(targetSize.data[0], targetSize.data[1], 1.0f, &modelViewMatrix.data[0]); SampleUtils::multiplyMatrix(&projectionMatrix.data[0], &modelViewMatrix.data[0] , &modelViewProjection.data[0]);
      
       glUseProgram(shaderProgramID); 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]);
      
       glEnableVertexAttribArray(vertexHandle);
      
       glEnableVertexAttribArray(normalHandle);
      
       glEnableVertexAttribArray(textureCoordHandle);
      
       glActiveTexture(GL_TEXTURE0);
      
       glBindTexture(GL_TEXTURE_2D, thisTexture->mTextureID);
       glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE, (GLfloat*)&modelViewProjection.data[0] );
       glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, (const GLvoid*) &planeIndices[0]);

-----------------------------------------------------------------------------------------------------------------------

and don't forget

#include <QCAR/ImageTarget.h>

 

 

 

could I use JPG or others 2D-picture to replace 3D object ?

June 30, 2012 - 3:45am #4

Sorry but I don't understan which part from renderFrame I have to replace. Could you add it?

could I use JPG or others 2D-picture to replace 3D object ?

June 30, 2012 - 2:03am #3

Thanks a lot. I had done it before, but the texture could not be shown, so sad~~~~

could I use JPG or others 2D-picture to replace 3D object ?

June 29, 2012 - 10:16am #2

These are the instructions that she was referring to. Basically you are going to define a plane and map your picture to that in the same way that you would map a texture to any other 3D model.

Start with the ImageTargets sample project. Open ImageTargets.cpp, located in the jni folder.

Add the following just after the includes at the top:

#include <QCAR/ImageTarget.h>

static const float planeVertices[] = { -0.5, -0.5, 0.0, 0.5, -0.5, 0.0, 0.5, 0.5, 0.0, -0.5, 0.5, 0.0, };

static const float planeTexcoords[] = { 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0 };

static const float planeNormals[] = { 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0 };

static const unsigned short planeIndices[] = { 0, 1, 2, 0, 2, 3 };

Now replace the OpenGL ES 2.0 rendering code in the renderFrame method with the following:

// assuming this is an image target

QCAR::Vec2F targetSize = ((QCAR::ImageTarget *) trackable)->getSize();

QCAR::Matrix44F modelViewProjection;

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

SampleUtils::scalePoseMatrix(targetSize.data[0], targetSize.data[1], 1.0f, &modelViewMatrix.data[0]); SampleUtils::multiplyMatrix(&projectionMatrix.data[0], &modelViewMatrix.data[0] , &modelViewProjection.data[0]);

glUseProgram(shaderProgramID); 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]);

glEnableVertexAttribArray(vertexHandle);

glEnableVertexAttribArray(normalHandle);

glEnableVertexAttribArray(textureCoordHandle);

glActiveTexture(GL_TEXTURE0);

glBindTexture(GL_TEXTURE_2D, thisTexture->mTextureID); glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE, (GLfloat*)&modelViewProjection.data[0] ); glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, (const GLvoid*) &planeIndices[0]);

Build the native code, using ndk-build for Android, then refresh the Eclipse or XCode project and run the app. You should see the teapot texture stretched over the image target.

You can swap the texture by adding your image to the project's assets folder (png or jpg format). Then open ImageTargets.java and look for the loadTextures() method. Replace the teapot texture filenames with your own. Note that the order the textures are added set the order they are stored in the native textures array (the first texture is at position 0).

Log in or register to post comments