反锯齿上的OpenGL ES 2.0 [英] Antialiasing on OpenGL ES 2.0

查看:1061
本文介绍了反锯齿上的OpenGL ES 2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何做三角形反锯齿对整个渲染?我应该把它放在fragmentShader?有没有改善这种事情任何其他好的解决方案?

How can I do antialiasing on triangles on the entire render? Should I put it on the fragmentShader? Is there any other good solution to improve this sort of thing?

下面是我的说法,非常脆边(不是很漂亮)。

Here is my "view", with very crispy edges (not very nice).

推荐答案

在做一些深入的研究后,我发现,这其实pretty简单,最comonly做的是使像有一个屏幕的4倍更大的(或甚至4倍以上)。渲染到这更多更大的屏幕后,GPU将采取该地区的avarege并设置基于像素的颜色。

After doing some Deep research, I found that It's in fact pretty simple, and the most comonly done is to render like there was a screen 4 times bigger (or even more than 4 times). After rendering to this much more bigger screen, the GPU will take the avarege of that area and set the pixel color based on that.

这是pretty容易与这个库启用此:

It's pretty easy to enable this with this library:

https://$c$c.google.com/p/gdc2011-android-opengl/source/browse/trunk/src/com/example/gdc11/MultisampleConfigChooser.java

https://code.google.com/p/gdc2011-android-opengl/source/browse/trunk/src/com/example/gdc11/MultisampleConfigChooser.java

不过,你应该记住,这将花费4个或更多倍的时间来呈现的一切,这意味着更多的时间来处理,也许,少FPS ...

However,you should keep in mind, that it will spent 4 or more times time to render everything, meaning more time to process, and perhaps, less FPS...

另外,如果你是用模拟OpenGL的Andr​​oid设备,看看你的GPU支持这种多重采样。矿为例,doesen't(Tegra的)。

Also, if you are emulating an android device with OpenGL, find out if your GPU supports this kind of Multisampling. Mine for example, doesen't (Tegra).

下面是最后的结果,具有和不具有多级:

Here is the final result, with and without multisampling:

这篇关于反锯齿上的OpenGL ES 2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆