Is it possible to use pixmaps on Android via Java API for GLES?

前端 未结 1 1103
旧巷少年郎
旧巷少年郎 2021-01-03 03:19

I\'m trying to implement off-screen rendering with OpenGL ES on Android. My ultimate goal is to improve performance of texture mapping which I do in plain java and Bitmap/in

相关标签:
1条回答
  • 2021-01-03 04:07

    The best way to improve texture loading performance on Android is to use the EGL image extensions you sited and EGL_NATIVE_BUFFER_ANDROID with native code. I have a code example of that in this article. I measured major performance improvements with this approach.

    Android has no support for Pixmaps and pbuffers do not work on Nvidia Tegra devices. You should use FBO-attached textures instead. That is the way the Android SurfaceTexture class is implemented.

    If you need alpha textures, that is another reason to use native code. There is a compatibility problem between Bitmap and OpenGL ES with alpha textures.

    Using hardware texture compression formats (ETC/PVR instead of PNG) and mipmaps improves the loading performance and quality of texture rendering a lot too, as discussed in this article.

    The big problem is glReadPixels(). EGL_NATIVE_BUFFER_ANDROID only works for writing textures, not for reading them back to a Bitmap. Android's platform code uses glReadPixels() to implement TextureView.getBitmap() and it is very slow. The best solution is to not copy the texture to a Bitmap, but to display the rendered TextureView directly which avoids glReadPixels().

    I have been working with OpenGL ES 2.0 and the situation may have been improved with 3.0.

    0 讨论(0)
提交回复
热议问题