PDA

View Full Version : [OpenGL] Rendering good looking lines



chronozphere
02-05-2009, 07:13 PM
Hey guys

I'm trying to render some geometry and I want to edges to look good. It now looks like this:

http://img9.imageshack.us/img9/6043/opengllines.jpg

You can see the black pixels near the lines. How to make this look better?

I use the following settings:


glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);

//My lines are a little thicker
glLineWidth(2);


I allready figured that disabling depth testing solved the problem but I rather don't do that, because I don't want to see any lines located behind other geometry.

Can someone help?

Thanks in advance. :)

User137
02-05-2009, 09:29 PM
Try render lines after geometry? The fading to black effect in lines comes when polygons hit the z-buffer caused by lines. However if you render lines infront they may appear almost non visible, and if you disable z-buffer for lines you would see lines that are in hidden backfaces too (this is solvable by manually calculating camera angle with faces ect.. hard).

NecroDOME
03-05-2009, 10:19 AM
Try to turn off anti aliasing?