安卓的OpenGL图像处理 - 没有SurfaceView [英] Android OpenGL image processing - without SurfaceView
问题描述
我想这样做使用OpenGL ES 2.0和着色器的背景图像处理,但没有拉丝的表面(即离屏渲染到帧缓冲区只)。虽然我已经在iOS上已经这样做了,我这个在Android上苦苦挣扎。
I want to do some background image processing using OpenGL ES 2 and shaders, but no drawing to a surface (i.e. off-screen rendering to framebuffers only). While I've already done so on iOS, I'm struggling with this on Android.
我想我接近创建工作OpenGL上下文,但还没有想出如何这样做没有SurfaceView。
I think I'm close to creating a working OpenGL context, but haven't figured out how to do so without a SurfaceView.
推荐答案
看一看这gamedev帖子(点击展开,查看完整的code)。在code创建一个GL上下文,并使用 GLSurfaceView.Renderer
接口,适当允许写渲染器。在调用 getBitmap()
,渲染器被称为画一个框架,然后读回,并转换为位图。
Have a look at this gamedev post (click on expand to view the complete code). The code creates a GL context and uses the GLSurfaceView.Renderer
interface to appropriately allow to write a renderer. On calling getBitmap()
, the renderer is called to draw a frame, which is then read back and converted to a Bitmap.
请注意,有一个特色的问题,这可能会感兴趣的你。
Note that there is a featured question, which might interest you, too.
这篇关于安卓的OpenGL图像处理 - 没有SurfaceView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!