By integration
on Wed, 06/20/2012 - 17:10
Well I Read Ksiva's post....
It stated how to change texture on tapping the screen...
Wel i hav in ImageTarget.cpp file----multiple targets loaded....
i.e I hav loaded mytaget1 with targetIndex= 0 as well as targetIndex=1
second mytarget2 with targetIndex=2...
I hav added in Imagetarget.java the following code
public boolean onTouchEvent(MotionEvent event)
{
if (event.getAction() == MotionEvent.ACTION_UP )
{
DebugLog.LOGI("swapping textures");
Texture temp = mTextures.elementAt(0);
mTextures.set(0, mTextures.elementAt(1));
mTextures.set(1, temp);
deinitApplicationNative();
initApplicationNative(mScreenWidth, mScreenHeight);
// Run initRendering on the GL Thread
mGlView.queueEvent(new Runnable()
{
public void run()
{
mRenderer.initRendering();
}
});
}
return true;
}
Well what happens is the target is displayed wel for both mytarget1 and mytarget2....It even swaps well and changes the texture for mytarget1 on tapping the screen...
However when the mytarget2 is tracked the texture is displayed well but on tapping multiple times in short duration on mytarget2 the application closes!!!
(IT WORKS WELL IF I TAP MYTARGET2 AFTER SOME SECONDS...)
I taught it would work well as even if i tap on other target it would just swap the position of mTexture 0 and mtexture 1...
The logcat also shows the log for swapping texture ...init deinitapplication native... AND NO ERROR IS DISPLAYED!!!
Re: Application closes!!!
Re: Application closes!!!
Re: Application closes!!!
Re: Application closes!!!
Re: Application closes!!!
Re: Application closes!!!