" />

How to embed a 3D HOOPS view in MFC Dialog based App?

  • Home
  • MFC
  • How to embed a 3D HOOPS view in MFC Dialog based App?

In this blog article, I will show you a simple way to embed a HOOPS view inside MFC (Microsoft Foundation Classes) dialog.

HOOPS MFC was designed around the MFC SDI & MDI architecture (i.e. Document, Frame and View) but dialog based MFC application have only one dialog and there is no view, no document and no frame.

Fig. 1. Dialog based MFC Application.

To embed a HOOPS view inside such an application, follow the steps below :-

  1. Add a Picture Control object from the Toolbox. Make sure that the picture control ‘Visible’ attribute is set to true. Save the changes.
  2. Add the OnInitDialog() function, and add an OnPaint message handler in the dialog class.
  3. Modify the body of the OnPaint function, and implement the OnInitDialog() function as shown below:
    1. Implement OnInitDialog() as follows.
      • Create a HOOPS MVO model and call its initialization function.
      • Retrieve the window handle.
      • Create a HOOPS MVO view with the window handle and the model created in earlier steps. Use any driver you want. I had used OpenGL for simplicity of the prerequisites.
      • Call the initialization function of the HOOPS MVO function.
      • Now the HOOPS View is prepared and ready for rendering.
    2. Implement the OnPaint() method which is a message handler and update the HOOPS MVO view in this method.*Note : Unless this you can’t render anything.
  4. After saving and rebuilding, you should see that the dialog box created will contain a HOOPS scene.

Fig. 2. Dialog Based MFC Application after rendering with HOOPS

Author : Sanyogita
For any Query regarding the content of the blog,please contact us :info@prototechsolutions.com



ProtoTech Solutions is a custom engineering software development company with skills in 3D visualization on desktop/mobile/cloud. My role in the company is essentially Business Development and Marketing.

View all posts by


You must be logged in to post a comment.