Sign in to follow this  
BertS

Menu/HUD sprites

Recommended Posts

Hello, I'm wondering how to implement HUD/menu sprites in an efficient manner. I'm using immediate mode for them right now (glBegin()...glEnd()) but I've read it's best to avoid that. Display lists seem ideal, but they leave me with a couple of questions: 1. the HUD/menu isn't completely static, meaning I'd have to have a seperate display list for almost every item. Will that create problems? 2. how can I integrate it nicely with my code? Do you write a "register" function, so the engine builds a display list for each item you add to your HUD/menu (grouping the static ones into 1 displaylist)? 3. should I simply stick to immediate mode? 4. how do you personally handle them in your projects? I'd be grateful for any advice on how to handle this best.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
display lists give good performance but it is not too bad to use immediate mode to render a few polygons. but i recommend you to use a texture atlas for gui and render all gui elements with one draw state, one call. (imaged elements can be render seperately) if your vertex datas are not static you can use vertex arrays.

Share this post


Link to post
Share on other sites
1. Multiple display lists generally arent a problem

2. Ive used the 'register' approach before but I found that it over complicated things but if you go for it then grouping the static items into 1 list seems an efficient way of doing it.

3 & 4 I use immediate mode these days for HUD / Menus - Its simple to write and maintain and dosent really hurt performance. If its not an in-game menu then theres no performance concerns anyway.

I suppose the best thing is to experiment but dont be afraid of a few glBegin/End - the performance hit is insignificant especially on modern hardware.

Share this post


Link to post
Share on other sites
Quote:
Original post by comedypedro
1. Multiple display lists generally arent a problem

2. Ive used the 'register' approach before but I found that it over complicated things but if you go for it then grouping the static items into 1 list seems an efficient way of doing it.

3 & 4 I use immediate mode these days for HUD / Menus - Its simple to write and maintain and dosent really hurt performance. If its not an in-game menu then theres no performance concerns anyway.

I suppose the best thing is to experiment but dont be afraid of a few glBegin/End - the performance hit is insignificant especially on modern hardware.


I usually work the same. Except in the case of my 3d text I usually use, all my GUI and HUD stuff is done in immediate mode, unless it is completely static, then I go ahead with the display list just because I can. This rarely happens though.

Share this post


Link to post
Share on other sites
with immediate mode a old card/computer can achieve > million quads sec
thus drawing 1000 quads for the HUD per frame is not gonna be a burden

*dont use DLs for something that changes each frame
*ideally look into using VAs (with perhaps VBOs) and draw all quads of the HUD (with the same texture) in one go

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this