Click here to Skip to main content
Click here to Skip to main content

OpenGL Win32 AppWizard

By , 19 May 2003
 

Sample Image - OGLWiz.gif
An example of a generated application

Installation (VC6 version)

Copy OGLWiz.awx and Oglwiz.hlp to your Custom AppWizard directory (probably "C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Template").

Overview of the generated project (VC6 version)

Projects generated with this AppWizard contains two classes:
  • CApp
  • CMainWnd
There is a global instance of CApp (gApp) that owns an instance of CMainWnd (m_pMainWnd). CApp creates the main window, initializes OpenGL, maintains the message pump and manages screen updates. CMainWnd encapsulates the main window and its OpenGL rendering context. CApp notifies CMainWnd of different phases of the OpenGL RC life cycle (by calling CMainWnd::InitScene(), CMainWnd::KillScene() and CMainWnd::DrawScene()). CMainWnd::Tick() is called (by CApp) each time the windows message queue is empty.

This may not be the most elegant OO solution; some of the code in CApp really belongs in CMainWnd, like window creation and (some of the) message handling. But the idea is to let CApp do the grunt work of Win32API and OpenGL setup and leave CMainWnd free to concentrate on what's displayed in the client area.

Using the wizard

Chose to create a new project, selecting "OpenGL Win32 Application" from the list of project types, enter a project name and press OK.

The following options to customize the project are available:

Application

Menu: Check this box to add a menu to the main window.
Keyboard accelerator: Adds a keyboard accelerator resource and processes accelerator keys.
About box: Creates an about dialog and a dialog callback routine. Also adds an About command to the menu (if available).

Main window

Select appearance of the main window.

Window: Creates an overlapped main window with default size.
Fullscreen: Creates a topmost popup window that occupies the entire screen.
Both: Appearence is determined with a switch: If FULLSCREEN is not #defined, the application runs in a window.
Show FPS in caption: Adds code to show Frames Per Second on regular intervals. (Not available in fullscreen mode)

OpenGL Support

Use OpenGL: Adds code to initialize and maintain an OpenGL RC. If this box is not checked, a plain Win32 application is created.
Sample code: Adds code that renders a simple OpenGL scene (spinning cube).
Double buffering: Creates a double-buffered pixel buffer.
Color depth: Number of color bitplanes in each color buffer.
Z-buffer depth: Bit-depth of the Z-buffer.
Background color: Press the button to select background color for main window.

Notes on the VC++.NET appwizard

In VC++.NET, appwizards are no longer compiled plugins, but rather a collection of scripts and template files, with a HTML-based UI. See Readme.txt for installation instructions.

I took the opportunity to change the object model into something that, IMO, is a bit cleaner. Instead of having one class for the window and one class for the application, there is now one abstract base class, CApp, that takes care of window creation, OpenGL initialization etc. The "meat" of the generated app goes in a derived class that overrides a number of virtual functions of CApp. For example, InitScene(), DrawScene() and KillScene() are virtual.

Other than that, the VC++.NET version of the AppWizard behaves basically the same as the VC++6 version.

History

  • 20 May 2003 - Updated VS.NET download

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Ulf Öhlén
Sweden Sweden
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralAbout coding a simple human facesussAnonymous26 Sep '05 - 8:46 
I need a openGL coded human face like any smiley Smile | :) , which should have some cartoony hair too.
 
Please can anybody provide me as early as possible!
 
Please!
 
I am witing for any help ! here!
 
Maddy
GeneralI need help on using this for an MDI appmembersardaukar_siet12 Feb '05 - 12:18 
(warning: I am a newbie coder) Smile | :)
 
I want to do an MDI app using C++ (VS.NET). My basic idea is to have an MDI child dialog with input boxes and a "go" button. From them on, these parameters are passed on to another class that chunks away calculations on them and returns draw commands. I would then like for another MDI child window (basically, an OpenGL "canvas") to receive and render them. I tried looking up examples for this, but they are either WinAPI (cryptic) or MFC and I was hoping to find a .NET "component" (with all advantages therecoming). Please give me any pointers to find my way out of this or better yet, some source code. Poke tongue | ;-P
GeneralGetting an error when trying to start a projectmemberTheTroll12310 Oct '04 - 10:49 
I get this error ever time I try to start the OpenGL Wizard. "Object with Program ID VsWizard.VsWizardEngine Cannot be Created. I have tested using a bunch of different Wizards and they are worked fine. I triple checked the Absolute Path and it is correct. I have Visual Studio .net Professional and I am using the .net version of the OpenGL AppWizard. Any ideas?
 
Thanks for any help anyone can provide.
TheTroll
GeneralRe: Getting an error when trying to start a projectmembergulumulu7 Oct '05 - 23:07 
I have the same problem.
QuestionHow to run 2 different(or same) OpenGL objects in one DialogBox?memberwerter13 May '04 - 21:11 

How to run 2 different(or same) OpenGL objects in one DialogBox?
IDC_STATIC1 is a first OpenGL objects Scene window.
IDC_STATIC2 is a second OpenGL objects Scene window.
IDC_STATIC1 and IDC_STATIC2 ,they are placed on IDD_DIALOG1.
 
code:
pclStatic = (CStatic *)GetDlgItem(IDC_OpenGL_Window);
pclGlView = new CGlView(pclStatic);
pclGlView->OnCreate();
pclGlView->InitGL();
pclGlView->DrawGLScene();
 
pclStatic1 = (CStatic *)GetDlgItem(IDC_OpenGL_Window);
pclGlView1 = new CGlView(pclStatic1);
pclGlView1->OnCreate();
pclGlView1->InitGL();
pclGlView1->DrawGLScene();
 
Will not involve both windows (IDC_STATIC2,IDC_STATIC1)
GeneralA suggestion.memberSevenCat15 Dec '03 - 23:49 
I think we can did all this in a DLL,or a LIB!
 
class Cttt3d : public CSCWin
{
}
 
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
Cttt3d win;
win.Create("faint",200,200,16,false,100,100,false);
win.StartRender();
return 0;
}
Questionhow can i add my own class to applicationsusswuling1291 Dec '03 - 14:07 
good morning:
There is some diffcult for me, a new programer,to use vc++6.0.I don't know how to add my own class which is based on object class into project.I'm waiting you response with great thanks.
My E-mail:wuling129@sohu.com
Thank you!
GeneralAll I get is a Blank form when I select this as a projectmemberMike_in_Paradise26 May '03 - 6:12 
as opposed to the window asking for options:
 
Running MSVC++.NET 2002
 
I look in:
 
C:\Program Files\Microsoft Visual Studio .NET\Vc7\VCWizards\OGLWiz7\HTML\1033\default.htm
 
and the HTML code is there:
 
I checked the OGLWiz7.vsz file in the directory
 
C:\Program Files\Microsoft Visual Studio .NET\Vc7\vcprojects
 
Here are the contents:
 
VSWIZARD 7.0
Wizard=VsWizard.VsWizardEngine
 
Param="WIZARD_NAME = OpenGL Application"
Param="ABSOLUTE_PATH = C:\Program Files\Microsoft Visual Studio.NET\Vc7\VCWizards\OGLWiz7"
Param="FALLBACK_LCID = 1033"
 
Any ideas???

GeneralRe: All I get is a Blank form when I select this as a projectmemberdpaquc22 Oct '03 - 5:19 
I have the exact same problem!
GeneralRe: All I get is a Blank form when I select this as a projectmemberwebbsk24 Nov '03 - 9:34 
So did I. The author tackles the same problem in the thread named, appropriately enough "Problem..."
 
The end result of the thread is that in the OGLWiz7.vsz file, the ABSOLUTE_PATH is set to "C:\Program Files\Microsoft Visual Studio.NET\Vc7\VCWizards\OGLWiz". But your installation of MSVS .NET probably named the folders as "...\Microsoft Visual Studio .NET\...". Notice how the second one has a space between "Studio" and ".NET" and the first one does not? (It took me 20min and reading through all the other messages to notice! D'Oh! | :doh: ) Double check that your file has the space between the words.
This should resolve the problem b/c I had the exact same problem and I'm using the 2003 upgrade version and Win2K but it worked for me.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 20 May 2003
Article Copyright 2001 by Ulf Öhlén
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid