Illuminating gl_lines

Hi,

is there a possibility to illuminate(highlighting) gl_lines? I think they need a normal vector, which i can generate in the vertex shader. They don’t have to look realistic, but I think it can help to discern them and create some depth.

Doen anyone know a good approach to this problem?

Why not use simple fog for depth cueing?

If you don’t want to actually draw cylinders, you might want to take a look at drawing normalmapped billboards instead. This is not quite as easy as simply using GL_LINES, but it shouldn’t be too difficult either :slight_smile:

Illuminated lines in good old fixed-path GL works already, nothing to do. Like for any geometry, provide normals and enable light.
You can try Dev-C++ template for freeglut.

It would be good idea to compute a view-dependent normal in the vertex shader on the fly. Instead of providing a normal to the vertexshader, provide it with the direction of the line or line segment (at the position of the vertex).
Then, in the vertex shader compute a normal which points into the direction of the viewer but still remains to be orthogonal to the provided direction (compute V then orthogonalize it to D). This way you´re effectivly emulating a thin cylinder which should give good lighting.

Originally posted by skynet:
It would be good idea to compute a view-dependent normal in the vertex shader on the fly. Instead of providing a normal to the vertexshader, provide it with the direction of the line or line segment (at the position of the vertex).
Then, in the vertex shader compute a normal which points into the direction of the viewer but still remains to be orthogonal to the provided direction (compute V then orthogonalize it to D). This way you´re effectivly emulating a thin cylinder which should give good lighting.

sounds, great do you have any more detailed information on this approach?