best method of drawing a HUD (and console)
im just recreating my game again from scratch (new rendering techniquies)
and im using most of my old code. im just introducing my console, (and with it the HUD) but i dont think the way ive been doing it is the best.
at the moment, i have a routine called "drawhudsqaure()"
the method basiccly runs as so, it sends an x,y,width and height, in the form of 0 to 1 (0 left, 1 far right of the screen, like a percentage) but, its all messy working out the width of the screen by trial and error and such, but i do get a global number for every resolution.
i was just wondering how everyone else was doing it, pixel based? or percentages or what?
also, im drawing my console, with each charcter on its own quad, is there a better way? (using a texture) say blt''ing or something (but in opengl )
__________________
graham "red" reeves.
red@deadpenguin.org
www.deadpenguin.org
__________________graham "red" reeves.[email=red@deadpenguin.org]red@deadpenguin.org[/email]www.deadpenguin.org
check the faq
http://www.frii.com/~martz/oglfaq/transformations.htm
http://members.xoom.com/myBollux
http://www.frii.com/~martz/oglfaq/transformations.htm
http://members.xoom.com/myBollux
March 09, 2001 09:20 PM
Welcome to the world of the HUD! I have never made a hud myself (no need to yet but what little experiance I have should be a help to you. I programmed Half-life mods for a while, so I know how they did it too.
First of all, I recommend you disable depth testing (speed baby) and shove her into ortho mode. Ortho mode is just a ton more ideal for any 2d situation. Set it to a good resolution(can be ANYTHING, even if the app isnt that) and that will be your coordinate base. For instance, if you set it to 640x480, 0,0 is the bottom-left of the screen, and it increments from there.
Rendering a giant quad like you said sounds really REALLY static or really clunky. In half-life, numbers, pictures, ect where drawn by sprites on the hud (unreal tourney has a "canvas" to draw to). Each object you see on the hud is a sprite (save text output, which is the titles- what you see in the tram ride eg "Subject: Gordon Freeman").
What I do is I use bitmapped (or in my specific case tgaed) fonts to display text, and then when I begin to need pictures I will implement a sprite hud system that will be similar. In ortho & no depth-test mode you wont have to worry about the scene distorting your hud at all.
Good Luck!
L8r,
Destiny Interactive Lead Coder,
The Rainmaker
First of all, I recommend you disable depth testing (speed baby) and shove her into ortho mode. Ortho mode is just a ton more ideal for any 2d situation. Set it to a good resolution(can be ANYTHING, even if the app isnt that) and that will be your coordinate base. For instance, if you set it to 640x480, 0,0 is the bottom-left of the screen, and it increments from there.
Rendering a giant quad like you said sounds really REALLY static or really clunky. In half-life, numbers, pictures, ect where drawn by sprites on the hud (unreal tourney has a "canvas" to draw to). Each object you see on the hud is a sprite (save text output, which is the titles- what you see in the tram ride eg "Subject: Gordon Freeman").
What I do is I use bitmapped (or in my specific case tgaed) fonts to display text, and then when I begin to need pictures I will implement a sprite hud system that will be similar. In ortho & no depth-test mode you wont have to worry about the scene distorting your hud at all.
Good Luck!
L8r,
Destiny Interactive Lead Coder,
The Rainmaker
i was using quads before, becuase i could easily use the transparencies and blending, and all the other effects avaible to me, rotation and such too for simple effects. i think the transformations are all i need
__________________
graham "red" reeves.
red@deadpenguin.org
www.deadpenguin.org
__________________
graham "red" reeves.
red@deadpenguin.org
www.deadpenguin.org
__________________graham "red" reeves.[email=red@deadpenguin.org]red@deadpenguin.org[/email]www.deadpenguin.org
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement