开发者

glPolygonOffset() bugs with lines

开发者 https://www.devze.com 2022-12-15 14:02 出处:网络
I have the following code: glEnable(GL_POLYGON_OFFSET_LINE); glPolygonOffset(1,1); // or 40,40 etc... doesnt help at all

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_BLEN开发者_如何学PythonD and GL_COLOR_LOGIC_OP

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


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消