Using Hieroglyph 3 (and D3D11) with MFC
I spent some of the Christmas vacation building a sample program for Hieroglyph 3 that shows how to use it within an MFC application. Several users of the library were asking for information about how to implement such an application, and I have worked with MFC a little before, so I dove into the task. I am also looking forward to developing some tools for my Kinect applications as well as Hieroglyph in general, so this is time well spent.
If you haven't used MFC before, or only use it occasionally, do yourself a favor and get a good book on it. Many people will tell you that MFC is too old and clunky to be useful, and they just might be right. There are lots of things that are not obvious in how they work until you are familiar with them. However, it has been around forever, there is lots of applications that have been built on it, and there are quite nice developer IDEs built right into Visual Studio for you to build dialogs with. Plus it doesn't cost anything, and there are lots of people that are familiar with it to boot.
I personally have the quite old Programming Windows with MFC book - but don't be fooled, even though it is old it is still very relevant. Understanding the basics of an application, a frame window, a document, and a view within the context of an SDI application can take a very long time if you are only using the raw documentation, and it is always handy to have a quick reference for the things you have forgotten...
Anyways, the basic concept for integrating a rendering library with MFC is to build a subclass of CView that will present a rendered scene to an HWND based window. The document is more or less just a scene in my sample application that consists of a single object. So a CView is responsible to take the document and render it into a window... This is precisely the same thing that a normal full screen application does, but you just have to package the various actions into an MFC class to allow it to work within the framework.
By creating such a class, the developer can then use it multiple times within an application to produce multiple rendered images of a given document. This is one of the things that MFC is really good at - once you have made the separation between data (as a document) and viewing (as a CView subclass) then there is lots of help to make multiple windows showing your data. The Hieroglyph 3 sample, appropriately named MFCwithD3D11, provides three resizable rendering windows in this fashion:
I haven't added mouse / keyboard interactivity to the views just yet, but that will be coming in the future. I would also like to add in some dialogs for configuring the various options of the rendered output, but that will take a bit more time to figure out what would make for a good example. If anyone out there has any interest in specific examples or features that they would like to see, please let me know and I'll add them into the queue