texture2d.crereexternaltexture (), um es an ein Material zu binden. /> In C ++ (GL -Textur+ JNI -Schnittstelle):
Ich erstelle eine Textur mit GL_TEXTURE_EXTERNAL_OESS verwendet OpenGL im Render -Thread und rufe dann mit < /code> JNI in Kotlin auf
Code: Select all
to configure a
Code: Select all
decoder and attach it to a Surface wrapping the
i rufen update)
I bind the texture using CreateExternalTexture() with the pointer from the plugin
I assign the texture to a material on a quad (shader is Unlit/Texture)
I also tried UpdateExternalTexture() every frame
Logs show decoding works (audio plays, MediaCodec queues and veröffentlicht Puffer)
Texturzeiger ist ungleich Null < /p>
Code: Select all
SurfaceTexture.updateTexImage()< /code> heißt
, aber nichts wird gerendert; Der Bildschirm bleibt schwarz. Surfacetexture.setonframeAvailableListener ()
Gibt es eine bessere Möglichkeit, die native OES -Textur an das Surfacetextur zu binden. longptr.toint () In Kotlin korrumpieren Sie den Texturzeiger?
C ++:
Code: Select all
glGenTextures(1, &g_VideoTextureId);
glBindTexture(GL_TEXTURE_EXTERNAL_OES, g_VideoTextureId);
glTexParameteri(...);
< /code>
Kotlin: < /p>
globalSurfaceTexture = SurfaceTexture(longPtr.toInt())
surface = Surface(globalSurfaceTexture)
< /code>
Einheit C#: < /p>
IntPtr ptr = new IntPtr(_longPtrValue);
videoTexture = Texture2D.CreateExternalTexture(width, height, TextureFormat.RGBA32, false, false, ptr);
targetRenderer.material.mainTexture = videoTexture;