iPhone OpenGLES 抗锯齿
我需要在 iPhone 3G (OpenGL ES1.1) 中使用抗锯齿功能,而不是使用 OpenGL ES.2.0 的 iPhone 3G。 我已经绘制了 3D 模型,接下来是:模型边缘的像素看起来像牙齿。
我尝试为纹理设置任何过滤器,但此过滤器仅使内部纹理看起来更好。
我怎样才能做出好的抗锯齿效果? 也许我应该使用任何平滑来绘制三角形?如果是,那么在 OpenGL ES1.1 中怎么可能?
谢谢。
I need in antialiasing in iPhone 3G (OpenGL ES1.1), NOT iPhone 3Gs with OpenGL ES.2.0.
I've draw 3d model and have next: pixels on the edges of the model look like teeth.
I've try set any filters for texture, but this filters making ONLY texture INSIDE look better.
How can i make good antialising ?
May be i should use any smooth for drawing triangles ? If yes, then how it possible in OpenGL ES1.1 ?
thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
从 iOS 4.0 开始,通过 Apple 对 OpenGL 的扩展直接支持全屏抗锯齿。基本概念与 epatel 的建议类似:将场景渲染到更大的帧缓冲区上,然后将其复制到屏幕大小的帧缓冲区,然后将该缓冲区复制到屏幕。不同之处在于,复制/采样操作不是创建纹理并将其渲染到四边形上,而是通过单个函数调用(具体来说,
glResolveMultisampleFramebufferAPPLE()
)执行。有关如何设置缓冲区和修改绘图代码的详细信息,您可以阅读 Gando Games 博客上的教程,是为 OpenGL ES 1.1 编写的;还有Apple 开发者论坛上的注释解释了同样的事情。
感谢 Bersaelor 在另一个问题中指出了这一点。
As of iOS 4.0, full-screen anti-aliasing is directly supported via an Apple extension to OpenGL. The basic concept is similar to epatel's suggestion: render the scene onto a larger framebuffer, then copy that down to a screen-sized framebuffer, then copy that buffer to the screen. The difference is, instead of creating a texture and rendering it onto a quad, the copy/sample operation is performed by a single function call (specifically,
glResolveMultisampleFramebufferAPPLE()
).For details on how to set up the buffers and modify your drawing code, you can read a tutorial on the Gando Games blog which is written for OpenGL ES 1.1; there is also a note on Apple's Developer Forums explaining the same thing.
Thanks to Bersaelor for pointing this out in another SO question.
您可以渲染到更大的 FBO,然后将其用作正方形上的纹理。
请参阅这篇文章了解解释。
You can render into a larger FBO and then use that as a texture on a square.
Have a look at this article for an explanation.
查看 eglChooseConfig(),以及glEnable(GL_MULTISAMPLE)。
编辑:嗯,显然你运气不好,至少到目前为止随着标准化方法的发展。正如该线程中提到的,您可以渲染到较大的屏幕外纹理并缩放到较小的屏幕四边形或多次抖动视图矩阵。
Check out the EGL_SAMPLE_BUFFERS and EGL_SAMPLES parameters to eglChooseConfig(), as well as glEnable(GL_MULTISAMPLE).
EDIT: Hrm, apparently you're out of luck, at least as far as standardized approaches go. As mentioned in that thread you can render to a large off-screen texture and scale to a smaller on-screen quad or jitter the view matrix several times.
我们找到了另一种方法来实现这一目标。如果您编辑纹理并添加例如 2 像素的透明像素帧,则纹理中的彩色像素会在必要时与透明像素混合,从而提供基本的抗锯齿效果。您可以在 我们的博客。
这种方法的优点是,您不会渲染更大的图像,或复制缓冲区,或者更糟糕的是,从缓冲区制作纹理,因此不会影响性能。
We found another way to achieve this. If you edit your textures and add for example a 2 pixel frame of transparent pixels, the colored pixels in the texture are blended with the transparent pixels when necessary giving a basic anti-aliasing effect. You can read the full article here in our blog.
The advantage of this approach is that you are not rendering a bigger image, or copying a buffer, or even worse, making a texture from a buffer, so there is no impact in performance.