You need to make sure you've got blending switched on, but sometimes graphics card drivers switch line anti-aliasing off anyway.
This is what they do in the OpenGL Red Book:
But I'd also change "GL_DONT_CARE" to "GL_NICEST".
Sometimes line anti-aliasing just doesn't work, and it's not particularly fast. I've seen a clever hack that uses a thin alpha-blended texture instead on a line, which is often faster, believe it or not.
This is what they do in the OpenGL Red Book:
glEnable (GL_LINE_SMOOTH); glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glHint (GL_LINE_SMOOTH_HINT, GL_DONT_CARE); glLineWidth (1.5);
But I'd also change "GL_DONT_CARE" to "GL_NICEST".
Sometimes line anti-aliasing just doesn't work, and it's not particularly fast. I've seen a clever hack that uses a thin alpha-blended texture instead on a line, which is often faster, believe it or not.