How to draw lines on a window?

Hi,

I want to draw lines on a object like a window. But sometime the lines are always sparkling, and they can’t be see clear.

I try codes below, however ther are still some errors.
How to do it!

glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);

glClear(GL_STENCIL_BUFFER_BIT);
glPushMatrix();

glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_ALWAYS, 3, 0xff);
glStencilOp(GL_KEEP, GL_REPLACE, GL_ZERO);
DrawWindow();

glDisable(GL_DEPTH_TEST);
glDepthMask(0);
glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_GREATER, 1, 0xff);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
            DrawLines();

glDisable(GL_STENCIL_TEST);
glEnable(GL_DEPTH_TEST);
glDepthMask(1);

glPopMatrix();

Thanks!

Anti-Aliasing would probably help I think.

-SirKnight

…or polygon offset, search for tutorials.

-Ilkka

Originally posted by JustHanging:
[b]…or polygon offset, search for tutorials.

-Ilkka[/b]

I try it, but it can’t resolve the problem

Perhaps you dind’t use it properly, check this thread http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/011688.html for an example.

If polygon offset or antialiasing don’t solve it, you’ll have to describe the problem in more detail, preferably with a screenshot.

-Ilkka