"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

set mTextures after initial call

I am trying to change mTextures from outside the loadTextures class. The idea is to be able to change a texture after loadTextures is called at startup. Have tried mTextures.set() and most other options from somewhere else in the ImageTargets class. Why is the mTextures.set() in loadTextures(), not able to change the texture and display something on command? Any direction would be helpful, Thank you, Grant

mTextures is just an array of texture objects that the native (C++) code queries to create OpenGL textures. The samples add textures to the array with the mTextures.add(Texture.loadTextureFromApk("filename.png", getAssets())); method call.

Kim I tried adding your reference to mRenderer into a separate method only called when the texture is changing. My method for this is called loadArt().

Take a look at ImageTargets.cpp. The initApplicationNative() method copies all of the texture information from Java to native. Then the initRendering() method generates OpenGL textures and loads this texture data into them.

Thanks Kim all worked out well. Thank you for the help. Im going to post a new thread on a different topic so look out. Problems with gestures, such as fling, over the camera. Thats for a new thread which i'll write now in rendering open GL.

I put that code in my ImageTargets.java, but when I touch the screen applications restarts and still uses old texture. I think I am missing [QUOTE]you have to bind these textures yourself when rendering your 3D content in the renderFrame() native method. [/QUOTE] part. Can you make it more clear?

The ImageTargets sample binds the texture in the ImageTargets.cpp renderFrame method with the following code: [CODE] // Choose the texture based on the target name: int textureIndex; if (strcmp(trackable->getName(), "chips") == 0) { textureIndex = 0; } else if (strcmp(trackable->getName(), "sto

rassall_jubair

Tue, 04/10/2012 - 03:59

[QUOTE=ksiva]Take a look at ImageTargets.cpp. The initApplicationNative() method copies all of the texture information from Java to native. Then the initRendering() method generates OpenGL textures and loads this texture data into them.

If you only have a small set of photos (e.g. less than 20) you may just want to load them all as textures and switch the texture index in the renderFrame method. If you want to load the image into texture memory on each tap you can use the code above and simply switch out the filename (e.g.

rassall_jubair

Wed, 04/11/2012 - 14:25

[QUOTE=ksiva]If you only have a small set of photos (e.g. less than 20) you may just want to load them all as textures and switch the texture index in the renderFrame method.

Sorry, we can't help with such specific coding problems, with the snippet above you should have everything you need to get started. The rest is just application-specific logic :) - Kim