The line and point features (GL_LINES, GL_LINE_LOOP, GL_POINT) are drawn with a preset pixel size, regardless of how close or distant they are in the scene. The line thickness is set with glLineWidth(w).

Objects drawn using triangles or quads (GLU_TRIANGLE_STRIP, GLU_QUADS, GLU_TRIANGLE_FAN), or the fancier glu tools, are rendered using as many pixels as needed, and disappear altogether if they get too distant from the camera.

This can be bad for the game, if the visual detail is important to the user, and is lost from view due to its distance. One way to manage this is to draw the object using the triangles or quads (or polygons, I suppose), and then outline them using lines of the same color. The lines will disappear when the object is close and rendered with many pixels, blending in, but will appear when the triangle rendering gets down to less than a pixel in size, and prevent it from disappearing.

You can even draw the lines inside the object, and they will be absolutely hidden until they are needed.

My own use for this arose when my foul lines and bases were being hidden from the user in my baseball simulation game Pitchers Duel. Outlining the white lines and bases with white 1 pixel lines ensures that they stay visible. I also used a two pixel point element inside the ball to ensure it does not go invisible as it soars for the distant outfield fence.

Advertisements