Tuesday 22 September 2009

Heads Up Display - Looking good

This weekend I began adding a head-up display system using OpenGL to draw complex line shapes as an overlay to scenes generated in the Leadwerks2 3D engine.

Problem I had before doing these HUDs was hard-coding all the locations. This time I'm using a system of relative points. With (0,0) as the center, (-1,-1) is top left, (1,1) bottom right.

This allows me to organise the HUD as a hierarchy and re-use elements for different vehicles/aircraft. As a benefit, it's resolution independent so should scale to any display device.

I will adapt the MFD code already in place, currently only the ground radar is operational, it needs to draw a lot of lines to represent the Arcs of the ground radar. It would benefit greatly from using OpenGL. I will optimise the HUD and MFD drawing to build all the HUD elements in the OpenGL buffer and only render them at the end of the update.

The only drawback is mixing in the text elements which use bitmap fonts in the LE2 engine. As I have to restore the OpenGL stack before using LE2, I wonder if there would be any benefit in populating my own command buffer to draw text after rendering the vectors (lines).

It's one possible optimisation to consider later.



No comments:

Post a Comment