🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Multiple Rendering Windows

Published April 07, 2009
Advertisement

Multiple Render Windows

When faced with the choice of windowing framework, I had originally planned on supporting MFC. After several suggestions, I was also considering Qt and wxWidgets. I spent a little time to figure out what I liked about each of the frameworks, and I realized that I could have my cake and eat it too - I was going to support all of them!

This sounds like a bunch of work initially, but if implemented properly it won't be too difficult. Up to this point in Hieroglyph's history, I had always used a single window for rendering (I recently added a window for script interaction, but not additional rendering) which we'll call a 'Win32' window. This is the standard Direct3D rendering sequence that most tutorials cover.

To support MFC, you (more or less) need to subclass a 'view' class and then render a scene and present it on the view's window handle. This is pretty much the same thing as the Win32 window - you need access to the window's handle, and you need to render something and present it to the window. In fact, this is the same thing that you would need for rendering in Qt or wxWidgets too - they are all the same.


How to do it?
So to support these frameworks as well as to support multiple rendering windows in standard Win32 applications, I now have a base class called 'RenderWindow' which provides a simple parameter interface. Then each subclass provides the system specific code for each framework. So far I have implementations for Win32 and MFC, and Qt and wxWidgets will come at some time in the future. Each subclass creates the window or panel, provides a 'paint' function for rendering the scene onto itself, and the rest is pretty much done. So now I can render to multiple windows, as shown below. One view shows only a visible scene, the other shows the scene with the physics overlay on it:



The particular uses of multiple rendering windows is still being worked out, but it completely fulfills the requirements for the GUI frameworks, so I am happy with it...
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement