Menu/HUD sprites

Started by
4 comments, last by BertS 18 years, 4 months ago
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.
Advertisement
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.
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.
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.


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
Thanks for your replies, rating++. Guess I'll be sticking to immediate mode for the time being.

This topic is closed to new replies.

Advertisement