tutorial 1 - simple project
Getting Started
To get started open up MS Visual C++ (hereafter know as MSVC) and if you want to,
your project workspace. Goto File|New and choose to create a new MFC
AppWizard Project. Choose a name for your project, I called mine "MFC_Tutorial_01".
Clicking on okay in the new project dialog window automatically runs the MFC AppWizard
and asks you what type of application you want. For this tutorial we need to select Dialog
based.
Next, the AppWizard asks us what features we want our dialog application to have.
We don't want to clutter up the code for this tutorial, so uncheck all the options and just leave
the 3D Controls option checked (although we won't use any in our application,
it will display standard windows interface controls in the familiar 3D fashion that we are all used
to).
You don't have to change any options in the next dialog. By default it will add comments
to the generated code to help you understand what everything does. I recommend you leave them enabled
until you are comfortable with MFC.
At Step 4, you will experience the horrible class names that MFC generates! You will
see two classes listed in front of you, CMFC_Tutorial_01App and CMFC_Tutorial_01Dlg.
The first one is the "Application Class" which you use in place of the winmain function
you use with Win32. The "Dialog Class" will be your window - it is here where you will place
your OpenGL code. To make your code easier to understand, I would suggest renaming the classes before
you click on Finish. I called mine "CApp"
and "CDlg" then renamed the dialog class source files to
"Dlg.h" and "Dlg.cpp"
respectively. Now you can click on the Finish button!
Original dialog: |
New class names: |
|
|
The AppWizard closes and leaves us with a very simple dialog window with OK and Cancel
buttons on it. I suggest you compile and execute the programme now to make sure that it works. When
you execute it, you should be presented with a dialog window that looks very much like this:
(Before you read on, you may want to add opengl32.lib to the project settings, if you
haven't already done so).
Part
1: Introduction
Part
2: Getting Started
Part
3: Creating a Window
Part
4: Using OpenGL
Go to Top