|Hosting by Solid Eight Studios,PhotoTangler Collage Maker|
Question submitted by (11 October 1999)
|Return to The Archives|
|How would I draw a crosshair in an OpenGL game I am writing. Right now I am using GL_LINES rotated to be just in front of my 'camera'. This strikes me as a poor way to do it. Please advise me on a better way.|
The typical way is to use a RGBA texture for the cross hairs and it gives a
lot more flexibility with what you can draw for a cross-hair than drawing
with GL_LINES. The simplest way to do this is to draw your scene normally,
then switch to an orthographic projection, turn off depth testing and place
the texture with screen coordinates. This is also the same method used to
draw other status indicators like health, score, time, etc.
Response provided by Tom Hubina
This article was originally an entry in flipCode's Fountain of Knowledge, an open Question and Answer column that no longer exists.