glPolygonOffset() bugs with lines

我与影子孤独终老i 提交于 2020-01-11 09:06:12

问题


I have the following code:

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

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.

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

Edit: i have already tried GL_POLYGON_OFFSET_FILL, it doesnt help.


回答1:


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.




回答2:


Try enabling GL_POLYGON_OFFSET_FILL instead. (I presume the lines are depth-fighting with polygons you have rendered earlier?)



来源:https://stackoverflow.com/questions/2020451/glpolygonoffset-bugs-with-lines

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!