internaut/ogles_gpgpu

OpenGL error in OGVideoProcDroid example (Android 4.4)

ruslo opened this issue · 5 comments

ruslo commented

Hi,

I'm trying to run OGVideoProcDroid example on my Android device and got runtime error. Here are the steps to reproduce:

  • Available targets
[ogles_gpgpu/examples/android/OGVideoProcDroid]> ./android list targets
Available Android targets:
----------
id: 1 or "android-19"
     Name: Android 4.4.2
     Type: Platform
     API level: 19
     Revision: 4
  • android update
[ogles_gpgpu/examples/android/OGVideoProcDroid]> android update project --target android-19 --path . --name OGVideoProcDroid
Updated project.properties
Updated local.properties
Updated file ./build.xml
Updated file ./proguard-project.txt
  • build
[ogles_gpgpu/examples/android/OGVideoProcDroid]> ndk-build
...
[...] Compile++      : og_jni_wrapper <= memtransfer_android.cpp
[...] SharedLibrary  : libog_jni_wrapper.so
[...] Install        : libog_jni_wrapper.so => libs/mips/libog_jni_wrapper.so
  • create APK
[ogles_gpgpu/examples/android/OGVideoProcDroid]> ant debug
...
-do-debug:
 [zipalign] Running zip align on final apk...
     [echo] Debug Package: /.../bin/OGVideoProcDroid-debug.apk
...
-post-build:

debug:

BUILD SUCCESSFUL
  • install
[ogles_gpgpu/examples/android/OGVideoProcDroid]> adb -d install -r bin/OGVideoProcDroid-debug.apk
4304 KB/s (1983478 bytes in 0.449s)
  pkg: /data/local/tmp/OGVideoProcDroid-debug.apk
Success

I've put some extra log messages (see my branch), look like it's crashing in camTexture.updateTexImage() method:

I/CamActivity(18175): Entering onFrameAvailable
I/CamActivity(18175): Try updateTexImage
W/Adreno-ES20(18175): <core_glBindTexture:572>: GL_INVALID_OPERATION
E/GLConsumer(18175): [unnamed-18175-0] bindTextureImage: error binding external texture image 0x5: 0x502
D/AndroidRuntime(18175): Shutting down VM

Thanks, Ruslo

@headupinclouds +cc

        windowSurface.makeCurrent();  // <=== this works

       // update camera frame texture
       GLES20.glActiveTexture(GLES20.GL_TEXTURE1);
ruslo commented

windowSurface.makeCurrent();

works for me

Hi, I didn't have the time to look into this for now, but if this fixes the error for you, please create a patch and submit a pull request.

ruslo commented

but if this fixes the error for you, please create a patch and submit a pull request

Yes it fixes the error but as you can see from the SO answer (answer by author of grafika) it may lead to problems with UI in future. Probably since UI/example is quite simple we don't see any glitches. I will take a look at possibility to move work with camera to a separate thread.