• Advertisement
Sign in to follow this  

Drawing my HUD

This topic is 4927 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok I'm trying to draw a HUD, well actualy thats later, right now I'm just trying 2 add a tag image to my engine. Which once done could easily be made into a HUD but thats off the point here... My understanding of rasterpos and drawpixels was that you were drawing to a section of the screen but aparently your drawing to coordinates in the world. I want to draw to just a portion of the screen like say the bottom 50 or 100 pixels (think doom HUD). Now I understand drawpixels is very expensive so I don't intent to use it. I was thinking i could possition a quad down there before my scene rotations and shit and texture it so it stays w\ the camera but is there another way? How are HUDs usualy drawn?

Share this post


Link to post
Share on other sites
Advertisement
switch to orthographic project, that will give you a 2D plane to work on and draw your hud on that AFTER the rest of the world (preferable with depth testing disabled)

Share this post


Link to post
Share on other sites
Quote:
Original post by Wavesonics
and still use drawpixels?


No, use the standard drawing procedures.

Share this post


Link to post
Share on other sites
um... srry for being a bit of a nub here but what would those be exactly. I have a book (which sux btw...) and it only has 2 functions for drawing 2D stuff, 1 is for bit maps the other is glDrawPixles. What should I use if not these?

Share this post


Link to post
Share on other sites
sorry, i wasnt clear about that, I was kinda following on from your idea about using a quad.

As MikeMJH says you should use the standard way of doing things, primatives and texturing as you would for any other drawing, it'll be MUCH MUCH MUCH (you get the idea) faster than Drawpixels will ever be.

Infact, as a rule of thumb you dont want to push pixels at the screen at all.

Share this post


Link to post
Share on other sites
aw awesome thx man. So is switching to orthographic nessisary then? I expect thats gotta be kinda expensive to switch ever frame. and if i just draw a 2D squad where I want and not have it affected by my translations and shit it should remain right up against the viewport and appear to b 2d.

Share this post


Link to post
Share on other sites
>>I expect thats gotta be kinda expensive to switch ever frame<<

only if you do it 1,000,000 times a frame. sticking to less than 1,000 x + u should be alright

Share this post


Link to post
Share on other sites
If you are REALLY that bothered about it you could pre-store the matrices in question and just glLoadMatrix them into the right matrix static, however this is somewhat pointless as 99.9% of the work the gfx card is going to be doing is going to be drawing your scene, 2 projective matrix switches per frame is nuffin at all in the grand scheme of things.

The total order of operations can be done as follows :

- switch to projective matrix
- push matrix
- switch to ortho mode
- switch to modelview matrix
- draw hud
- switch to projective matrix
- pop matrix
- switch to modelview matrix

very very cheap, in fact it probably costs more to switch a texture or two...

Share this post


Link to post
Share on other sites
awesome thx man, so the push and pop take care of switching back to the original prospective? Thats awesome.

Is this really how HUDs are done? I guess most stuff like say life counters are done with rendering out font text since changing the texture every time to 1 displaying a new number would suck.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement