7

我正在开发一个 Android 应用程序类型的手指画。我正在使用 OpenGL ES 2.0。基本上我有一个图像,其中每个触摸屏都应对应于要应用的圆形 alpha,它显示位于下方的另一个图像。我尝试了不同的技术,但速度相当慢,因为它的功能就像使用有机 glTexSubImage2D 减慢渲染阶段一样。我试图了解 FBO 的使用,因为它们允许离屏渲染。有人可以更好地解释渲染离屏意味着什么以及加快我的方法可以获得哪些优势?

我想离屏意味着你可以改变我创建的帧缓冲区,不影响onDrawFrame?在另一个线程中?

4

2 回答 2

2

In addition to being able to render into an on-screen window using OpenGL ES 2.0, you can also render into nonvisible off-screen surfaces called pbuffers (short for pixel buffer). Pbuffers can take full advantage of any hardware acceleration available to OpenGL ES 2.0, just as a window does. Pbuffers are most often used for generating texture maps. If all you want to do is render to a texture, we recommend using framebuffer objects (covered in Chapter 12, “Framebuffer Objects”) instead of pbuffers because they are more efficient. However, pbuffers can still be useful for some cases where framebuffer objects cannot be used, such as when rendering an off-screen surface with OpenGL ES and then using it as a texture in another API such as OpenVG.

[source : OpenGL ES 2.0 programming guide]

I hope this helps. Read this carefully - "pbuffers can still be useful for rendering to an off-screen surface with OpenGL ES"

于 2013-01-20T13:27:42.590 回答
0

您的方法占用了大量内存带宽,因为您需要读回(部分)屏幕并将相同数量的数据再次写回 GPU 内存。这真的很慢,并且使您的绘图代码在图像被移回 GPU 之前等待,然后再进行渲染。您是否考虑过为每个手指按压绘制四边形或某种近似您需要的图元?为什么你需要 OpenGL 呢?

于 2013-01-17T17:06:50.170 回答