View Full Version : First Person Shooter Interface
31337
12-21-2002, 07:11 PM
Can anybody point me in the direction I need to go in in order to create a "HUD" for my first person shooter interface? Something that will display like the persons health etc.
I'm looking for mainly how to create a crosshair in the middle of the screen. Any help, links, information, or sample code would be greatly appreciated.
M/\dm/\n
12-22-2002, 12:24 AM
After you've drawn your scene, call matrixmode to projection then Ortho2d and draw your HUD, don't forget to return to projection mode afterwards http://www.opengl.org/discussion_boards/ubb/biggrin.gif www.gametutorials.com (http://www.gametutorials.com) , masking could be handy http://www.opengl.org/discussion_boards/ubb/biggrin.gif
[This message has been edited by M/\dm/\n (edited 12-22-2002).]
31337
12-22-2002, 07:40 AM
glMatrixMode( GL_PROJECTION ); // For drawing the HUD
glOrtho(0, 100, 0, 100, 0, 1);
glLoadIdentity();
glColor3f(1, 1, 1);
I tried putting that in and drawing afterwards but I didn't see anything. I'm a little confused about the near/far arguements. What should I put them to be considering I dont want depth?
31337
12-22-2002, 07:42 AM
I've tried testing it with glvertex2f and 3f and niether works...
Try this out:
glMatrixMode( GL_PROJECTION );
glOrtho(0, 100, 0, 100, 0, 1);
glLoadIdentity();
glColor3f(1, 1, 1);
//add this
glMatrixMode(GL_MODELVIEW);
glDisable(GL_DEPTH_TEST);
Now (0|0) is your lower left corner of the screen and (100|100) is the upper right corner of the screen.
That should solve your problem.
Jan.
M/\dm/\n
12-22-2002, 09:31 AM
I' wrote return to prejection, should be modelview as in post above http://www.opengl.org/discussion_boards/ubb/frown.gif
31337
12-23-2002, 07:34 AM
So now I should be able to use glVertex2f to draw polygons and stuff right? I tried to and it doesnt appear to be working, maybe I just cant see the polygon...
Sparker
12-24-2002, 09:38 PM
Originally posted by 31337:
Can anybody point me in the direction I need to go in in order to create a "HUD" for my first person shooter interface? Something that will display like the persons health etc.
I'm looking for mainly how to create a crosshair in the middle of the screen. Any help, links, information, or sample code would be greatly appreciated.
-----------------
Well i have something 4U to take a look about Graphics pointers, crosshairs and HUDs
but it's a .RAR, so give an e-mail address to sen U'daScraps! http://www.opengl.org/discussion_boards/ubb/frown.gif
Sparker
12-24-2002, 10:42 PM
Originally posted by 31337:
Can anybody point me in the direction I need to go in in order to create a "HUD" for my first person shooter interface? Something that will display like the persons health etc.
I'm looking for mainly how to create a crosshair in the middle of the screen. Any help, links, information, or sample code would be greatly appreciated.
Try this: http://www.gametutorials.com/Tutorials/opengl/OpenGL_Pg1.htm
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.