• entries
    316
  • comments
    485
  • views
    321866

Refactoring the GUI

Sign in to follow this  
Jason Z

255 views

I have been noticing that rendering my GUI elements is really a performance hog. After running some tests with PIX, I was able to figure out that each of my textured buttons was setting the same texture right before it was rendered. This amounted to about 45 set texture calls on a scene that only had non-textured geometry and a GUI in it!!!

Needless to say, I spent my development time today refactoring my GUI components. They used to be a sort of special case object similar to the DXUT library. Now I have changed them to be integrated as objects in the scene graph, so that they can be sorted and culled just like any other object in my normal 3D scene graph.

At first thought it doesn't make sense to put 2D components and 3D objects together, but after considering that the scene graph just holds objects that may need to be rendered this frame it started to clear up. In fact, by implementing these objects as scene graph objects it will make it extremely easy to switch to a fully 3D GUI and at the same time retain the functionality of the 2D version.

All that, plus I get the performance improvements from grouping things together. GUI refactoring is not the most exciting, but it really seems to have helped out quite a bit.
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

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