从 Android 17开始,它提供了android.media.effect包,用于处理具有许多效果的图像.并且使用官方样本’HelloEffect’,它仅适用于图像. 现在我想应用Android相机预览帧的效果,我使用SurfaceTexture和GL
现在我想应用Android相机预览帧的效果,我使用SurfaceTexture和GL_TEXTURE_EXTERNAL_OES纹理来渲染相机的帧.
但问题是如何在这个特殊纹理上应用效果:GL_TEXTURE_EXTERNAL_OES,它显示错误,似乎无法从这个特殊纹理中采样.
错误:
01-06 15:46:35.425: D/libEGL(14021): loaded /vendor/lib/egl/libEGL_adreno.so 01-06 15:46:35.435: D/libEGL(14021): loaded /vendor/lib/egl/libGLESv1_CM_adreno.so 01-06 15:46:35.435: D/libEGL(14021): loaded /vendor/lib/egl/libGLESv2_adreno.so 01-06 15:46:35.435: I/Adreno-EGL(14021): : EGL 1.4 QUALCOMM build: _msm8974_refs/tags/AU_LINUX_ANDROID_JB_3.1.2.04.02.02.125.032_CL3849330_release_AU (CL3849330) 01-06 15:46:35.435: I/Adreno-EGL(14021): OpenGL ES Shader Compiler Version: 17.01.10.SPL 01-06 15:46:35.435: I/Adreno-EGL(14021): Build Date: 10/21/13 Mon 01-06 15:46:35.435: I/Adreno-EGL(14021): Local Branch: jb_3.1.2 01-06 15:46:35.435: I/Adreno-EGL(14021): Remote Branch: quic/4da73f3b691eea7a9356efff8d609916f1975107 01-06 15:46:35.435: I/Adreno-EGL(14021): Local Patches: NONE 01-06 15:46:35.435: I/Adreno-EGL(14021): Reconstruct Branch: NOTHING 01-06 15:46:35.565: D/OpenGLRenderer(14021): Enabling debug mode 0 01-06 15:46:36.295: W/Adreno-ES20(14021): : GL_INVALID_OPERATION 01-06 15:46:36.295: E/MCA(14021): GL Error: Operation 'Binding Texture' caused GL error (0x502) 01-06 15:46:36.295: E/MCA(14021): BindInputTextures failed 01-06 15:46:36.295: E/MCA(14021): Unable to render frame 01-06 15:46:36.295: E/MCA(14021): ShaderProgram: error processing shader! 01-06 15:46:36.305: W/dalvikvm(14021): threadid=11: thread exiting with uncaught exception (group=0x419fd898) 01-06 15:46:36.345: E/AndroidRuntime(14021): FATAL EXCEPTION: GLThread 97443 01-06 15:46:36.345: E/AndroidRuntime(14021): java.lang.RuntimeException: Error executing ShaderProgram! 01-06 15:46:36.345: E/AndroidRuntime(14021): at android.filterfw.core.ShaderProgram.process(ShaderProgram.java:123) 01-06 15:46:36.345: E/AndroidRuntime(14021): at android.filterfw.core.Program.process(Program.java:32) 01-06 15:46:36.345: E/AndroidRuntime(14021): at android.filterpacks.imageproc.LomoishFilter.process(LomoishFilter.java:200) 01-06 15:46:36.345: E/AndroidRuntime(14021): at android.filterfw.core.Filter.performProcess(Filter.java:474) 01-06 15:46:36.345: E/AndroidRuntime(14021): at android.filterfw.core.FilterFunction.execute(FilterFunction.java:80) 01-06 15:46:36.345: E/AndroidRuntime(14021): at android.filterfw.core.FilterFunction.executeWithArgList(FilterFunction.java:97) 01-06 15:46:36.345: E/AndroidRuntime(14021): at android.media.effect.SingleFilterEffect.apply(SingleFilterEffect.java:76) 01-06 15:46:36.345: E/AndroidRuntime(14021): at com.csz.camerafilters.activity.render.SurfaceRenderer.applyEffect(SurfaceRenderer.java:73) 01-06 15:46:36.345: E/AndroidRuntime(14021): at com.csz.camerafilters.activity.render.SurfaceRenderer.onDrawFrame(SurfaceRenderer.java:63) 01-06 15:46:36.345: E/AndroidRuntime(14021): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1531) 01-06 15:46:36.345: E/AndroidRuntime(14021): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)我能够使用适用于Android的 OpenCV SDK在相机帧上应用效果.他们有一个现成的样本显示.