Android的 - 如何绘制在OpenGL 2.0线框过对象吗? [英] android - How do I draw a wireframe over object in opengl 2.0?

查看:212
本文介绍了Android的 - 如何绘制在OpenGL 2.0线框过对象吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在OpenGL ES 2.0的创建一个四面体对象。我试图做到的,是展现多边形在其基本颜色的实际线框。是否有实现这一效果的方法?

I have a tetrahedron object created in openGL ES 2.0. What I'm trying to achieve is to show the actual wireframe of the polygon over its base color. Is there a method for achieving this effect?

另外,我的四面体是粉红色的。我怎样才能改变它的颜色?

Also, my tetrahedron is pink. How can I change its color?

推荐答案

在除了java的东西说。相反,扩大整个对象(其最佳的量总是取决于对象和当前视图上),以prevent Z-战斗文物,你也可以使用多边形偏移量(使用的 glPolygonOffset ),其主要的应用确实线框覆盖。

In addition to what Jave said. Instead of enlarging the whole object (whose optimal amount always depends on the object and the current view) to prevent z-fighting artefacts, you can also use the polygon offset (using glPolygonOffset), whose major application are indeed wireframe overlays.

基本上,它的工作原理是小幅调整所产生的碎片,这你不能在ES实现方式不同,因为你不能写深度缓存(我猜的深度值是他们没有从ES放弃它的原因,如他们在桌面GL 3+)做到了。所以你基本上呈现您固体对象,并使用相同的顶点的对象的线的版本,但使用用于固体对象稍微增加得到的片段的深度值(推动它们远离观察者)的多边形偏移配置,从而将三角形总是视图空间(或窗口空间实际上)背后的纹路。请参见这里了解更多信息。

It basically works by slightly adjusting the depth values of the resulting fragments, which you cannot achieve differently in ES, since you cannot write to the depth buffer (which I guess is the reason they didn't drop it from ES, like they did in desktop GL 3+). So you basically render your solid object and your line-version of the object using the same vertices, but using a polygon offset configuration for the solid object that slightly increases the resulting fragments' depth values (pushes them away from the viewer), thus placing the triangles always behind the lines in view space (or window space actually). See here for further information.

虽然一个四面体的情况下,可能会使,因为它的边缘非常锐利的一些问题。

Though the case of a tetrahedron might make some problems because of its very sharp edges.

这篇关于Android的 - 如何绘制在OpenGL 2.0线框过对象吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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