PDA

View Full Version : the flash problem of Antialiased line in Enable Depth Test 3D Scene!



will_cn
09-18-2002, 06:19 PM
hello, everyone.My nut is when I wanna draw some 3D lines in a 3D filled surface,and enable depth test together by using code glEnable(GL_DEPTH_TEST).Then I found the lines always flashed when I rotated the total subject(the surface and the lines).In addition, I used Antialiased lines in my coding.
How can I solve this flashed problem??

vshader
09-18-2002, 10:58 PM
use glPolygonOffset() on the lines. i think there is a mode to do this for GL_LINES primitives. it will offset the depth values of the lines so you dont get the Z-fighting you are seeing (the flashing lines). the probelm is that depth values for the lines are almost the same as the filled surface, numerical precision errors are causing the relationship to change when you rotate. see the red book (openGL programming guide) for info.

[This message has been edited by vshader (edited 09-19-2002).]

Fredz
09-20-2002, 08:00 AM
You can't use glPolygonOffset() on the lines, see :
http://www.opengl.org/developers/faqs/technical/polygonoffset.htm#0040

But you can use glPolygonOffset() to push back the polygons where your lines must be drawn.

will_cn
09-22-2002, 03:43 AM
I'd correct the problem by apply glPolygonOffset() in my surface codes, So it OK!
Thank you very much!