internaut / ogles_gpgpu

GPGPU for mobile devices and embedded systems using OpenGL ES 2.0
http://www.mkonrad.net/projects/ogles_gpgpu.html
Apache License 2.0
74 stars 39 forks source link

OpenGL error in OGVideoProcDroid example (Android 4.4) #1

Open ruslo opened 9 years ago

ruslo commented 9 years ago

Hi,

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

[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
[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
[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
[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
[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

headupinclouds commented 9 years ago
        windowSurface.makeCurrent();  // <=== this works

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

windowSurface.makeCurrent();

works for me

ruslo commented 9 years ago

http://stackoverflow.com/questions/27626002/camera-preview-using-surface-texture

internaut commented 9 years ago

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 9 years ago

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.