Framework       

This page explains how to use the class CMyd3dclassApp, part of the library d3dView. This class allow to build very easily 3d tools. The framework is composed of three views. The one on the left is dedicated to rendering. The user can manipulate the scene with the mouse (object rotation, translation, zoom and first person camera changes). The one in the upper right corner shows the infos related to Diretc3D, for example, the FPS. In the lower right view, one can easily add widgets for tuning its program.

Here is an example :


Download

download  : the library (one .lib and one .res for ressources) or the whole code source.


Tutorial

In the following lines, i explain shortly how to use my application class. This is very simple since when user does not have its rendeing view ready, it's still possible to use the class with a default scene, it displays a basic triangle with diffuse color, and there is no button to tune the animation.

The first step is thus to use the default behavior for the class :

  1. Create a new Win32 Application
  2. Choose Simple Win32 Application
  3. Add the line #include <afxwin.h> in your StdAfx.h file and delete #include <windows.h>
  4. In the main cpp file, delete the WinMain function
  5. In the main cpp file, add the line  : #include "myd3dclass.h"
  6. In the main cpp file, add the line  : CMyd3dclassApp theApp;  this replaces the WinMain function entry point
  7. In projects->settings->link, you must link with the libraries : d3dView.lib d3d9.lib d3dx9.lib winmm.lib dxerr9.lib
  8. In projects->general, you must specify : "use MFC in a shared dll"
  9. Then add the file : myd3dclass.res
  10. On my config, i must clean and then recompile to get it working

For using its own class for rendering, best is to inheritate the class CMyd3dclassView like the default class does. This class must redefine a few thinks like : initGeometry,render... For seeing its parameters in the lower left view, one can create a new formview. When this two classes are defined, pass them to the constructor of CMyd3dclassApp like this :

CMyd3dclassApp(RUNTIME_CLASS(my_rendering_class) , RUNTIME_CLASS(my_parameters_view_class)) and this should work. Easy, isn't it ?


 

Author :  Adrien Auclair  
adrien.auclair at club-internet.fr
Last update : 17/11/2004