带行的glPolygonOffset()错误 [英] glPolygonOffset() bugs with lines

查看:125
本文介绍了带行的glPolygonOffset()错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码:

glEnable(GL_POLYGON_OFFSET_LINE);
glPolygonOffset(1,1); // or 40,40 etc... doesnt help at all

但是这些线仍然在争战,这是常见的错误还是什么...?我的线是1.0f厚,我在场景的最后画线.

But the lines are still z-fighting, is this common bug or something...? My lines are 1.0f thick and i draw the lines last in the scene.

我还禁用了GL_ALPHA_TEST和GL_LINE_SMOOTH并启用了GL_BLEND和GL_COLOR_LOGIC_OP

Also i have disable GL_ALPHA_TEST and GL_LINE_SMOOTH and enabled GL_BLEND and GL_COLOR_LOGIC_OP

编辑:我已经尝试了GL_POLYGON_OFFSET_FILL,它没有帮助.

i have already tried GL_POLYGON_OFFSET_FILL, it doesnt help.

推荐答案

GL_POLYGON_OFFSET_LINE仅适用于使用glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)进行多边形渲染.如果使用GL_LINES绘制图元,则该图不起作用.在这种情况下,您将必须手动偏移顶点.

GL_POLYGON_OFFSET_LINE only works for polygon rendering with glPolygonMode(GL_FRONT_AND_BACK, GL_LINE). If you're drawing primitives with GL_LINES it doesn't work. In this case you'll have to manually offset the vertices.

这篇关于带行的glPolygonOffset()错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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