Log in or register to post comments

Texture change app help

September 6, 2011 - 2:52am #1

I have been toying with mixing up features of the different samples to work out the best way to do this, but I keep just creating apps that crash on load. Essentially what I am trying to do is this:

There is 1 object plane with multiple textures. When the object loads on the target, I want a button, similar to the ones in the dominoes app show up (or they can already be there, it doesn't matter that much). I want one of the buttons to cycle through the textures (around 5 in total) one by one, each time it is pressed (similar to the virtual buttons app but not return to the first texture each time the button is released). I want the other button to be able to do a screen capture. This is pretty much all I need the app to do for now, but I can't seem to work out how to correctly alter the dominoes app in order to place the plane in and alter the button functions, or import the dominoes guimanager correctly into the imagetargets app.

Also, when I create a plane, and I place a png texture over its surface, where ever the texture does not cover it is black, but I want it to be transparent. I am also trying to work out how to make the plane very large, so an image of any size can fit on it without being restricted or warped.

I understand this is a massive ask but if you could give me some hints that would be greatly appreciated.

Cheers

Re: Texture change app help

September 6, 2011 - 8:08pm #3

In ImageTargets.java you can modify the onOptionsItemSelected method to call a native method when a menu button is pressed. We talked about how to use the JNI to call down to native here: http://ar.qualcomm.at/node/2000823

For transparent textures you'll need to enable blending in OpenGL. Add this towards the top of your renderFrame method:

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

And be sure to disable it at the bottom:

glDisable(GL_BLEND);

- Kim

Re: Texture change app help

September 6, 2011 - 3:18am #2

What I would preferably want is for my already built ImageTargets app that has the plane, and alter the native menu to replace the flash/focus items with change texture and screenshot options. If this is possible...

Log in or register to post comments