- Home /
android how to use unity Image GetNativeTexturePtr
Hi,i want to let andorid use unity3D image ,
public void SetUnityTexture(final int iTextureID) { Log.d(TAG, "SetUnityTexture: -----------------------"); try { int [] textures = new int[1]; textures[0] = iTextureID; glGenTextures( 1, textures,0 ); glBindTexture( GL_TEXTURE_EXTERNAL_OES, textures[0] ); glTexParameterf( GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameterf( GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexParameterf( GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); glTexParameterf( GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); glBindTexture( GL_TEXTURE_EXTERNAL_OES, 0 );
m_iUnityTextureID = textures[0];
m_SurfaceTexture = new SurfaceTexture(textures[0]);
m_SurfaceTexture.setOnFrameAvailableListener(this);
m_SurfaceTexture.setDefaultBufferSize(1024,768);
m_Surface = new Surface(m_SurfaceTexture);
mMediaPlayerWrapper.setSurface(m_Surface);
}
catch (Exception ex)
{
Log.i(TAG, "SetUnityTexture: !!!!!!!!!!!!!!!!!!!!!!!!!!===>" + ex.getMessage());
}
// m_UnityActivity.runOnUiThread(new Runnable() { // @Override // public void run() { // // } // });
}
but it does not works don't know how to solute it.
Your answer
Follow this Question
Related Questions
Detecting more than 1 button clicks in Unity Android. 1 Answer
desktop,ios and android script differences?? 2 Answers
Load images seamlessly from internal storage in unity android? 0 Answers
How do I make an Object be destroyed just by tapping it? 1 Answer
Image captured and stored from IOS device won't display when access from Unity Editor 0 Answers