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

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralSimple and elegant - my 5memberSharjith22 Mar '11 - 8:32 
GeneralVisual Studio 2008 (9) version? [modified]memberhain7 Jan '09 - 6:49 
GeneralglReadPixels()memberJeanFilion12 Aug '07 - 3:33 
QuestionRe: glReadPixels()memberBilica29 Nov '07 - 6:02 
Hi there,
 
I am having the same problem here...
 
Does anybody have any idea about this problem?
 
Cheers folks!
AnswerRe: glReadPixels()memberJeanFilion29 Nov '07 - 8:02 
Questionhow to do real-time image processing using VC++?memberli zhiyuan25 Jun '07 - 22:01 
AnswerRe: how to do real-time image processing using VC++?memberzafersavas8 Jun '08 - 2:22 
GeneralErrors in scriptmemberBruzak12 Apr '07 - 4:32 
GeneralStart Maximizedmemberrfs671816 Dec '06 - 14:25 
Questionhow to combine two program??membermallie26 Mar '06 - 19:28 
QuestionVisual Studio 2005memberjpummill23 Nov '05 - 7:02 
AnswerRe: Visual Studio 2005memberbrianpoteat24 Aug '07 - 10:01 
GeneralAbout coding a simple human facesussAnonymous26 Sep '05 - 8:46 
GeneralI need help on using this for an MDI appmembersardaukar_siet12 Feb '05 - 12:18 
GeneralGetting an error when trying to start a projectmemberTheTroll12310 Oct '04 - 10:49 
GeneralRe: Getting an error when trying to start a projectmembergulumulu7 Oct '05 - 23:07 
QuestionHow to run 2 different(or same) OpenGL objects in one DialogBox?memberwerter13 May '04 - 21:11 
GeneralA suggestion.memberSevenCat15 Dec '03 - 23:49 
Questionhow can i add my own class to applicationsusswuling1291 Dec '03 - 14:07 
GeneralAll I get is a Blank form when I select this as a projectmemberMike_in_Paradise26 May '03 - 6:12 
GeneralRe: All I get is a Blank form when I select this as a projectmemberdpaquc22 Oct '03 - 5:19 
GeneralRe: All I get is a Blank form when I select this as a projectmemberwebbsk24 Nov '03 - 9:34 
GeneralRe: All I get is a Blank form when I select this as a projectmemberSevenCat15 Dec '03 - 23:44 
Generalbug fix with Microsoft Visual Studio .NET 2003membermarkthecoder15 May '03 - 21:01 
GeneralListen to this guy!sussAnonymous4 Jul '03 - 4:33 
GeneralThanks, what about Microsoft Visual Studio .NET 2005memberceman8228 Jan '07 - 3:03 
GeneralRe: Thanks, what about Microsoft Visual Studio .NET 2005membermarkthecoder29 Jan '07 - 13:19 
GeneralIt crashed!memberHALi9 Apr '03 - 21:17 
GeneralRe: It crashed!memberRizwanSattar13 Apr '03 - 5:37 
Generalsome opinions/ideasmemberKoray Balci20 Mar '03 - 23:09 
QuestionVC++ appwizard??memberSuper Jack15 Jan '03 - 4:38 
AnswerRe: VC++ appwizard??memberUlf Öhlén15 Jan '03 - 6:21 
GeneralRe: VC++ appwizard??memberSuper Jack15 Jan '03 - 23:51 
GeneralRe: VC++ appwizard??memberbear_16 Jan '03 - 7:18 
GeneralRe: VC++ appwizard??memberUlf Öhlén16 Jan '03 - 8:00 
GeneralRe: VC++ appwizard??memberSuper Jack17 Jan '03 - 6:40 
GeneralRe: VC++ appwizard??memberhain19 Feb '03 - 6:40 
GeneralRe: VC++ appwizard??memberJM100013 Jun '06 - 4:03 
GeneralRe: VC++ appwizard??memberKoray Balci20 Mar '03 - 1:57 
GeneralRe: VC++ appwizard??membershaul224 Apr '03 - 21:41 
GeneralRe: VC++ appwizard??memberUlf Öhlén15 May '03 - 0:09 
GeneralRe: VC++ appwizard??memberolmec_the_holy11 Sep '03 - 22:57 
GeneralProblem...memberAli Khanlarkhani12 Jan '03 - 20:30 
GeneralRe: Problem...memberUlf Öhlén13 Jan '03 - 4:25 
GeneralRe: Problem...memberJyrki Rasku23 Jan '03 - 1:09 
GeneralRe: Problem...memberhain18 Feb '03 - 11:30 
GeneralRe: Problem...memberSynetech18 Feb '03 - 13:33 
GeneralRe: Problem...memberhain19 Feb '03 - 6:31 
GeneralRe: Problem...memberUlf Öhlén20 Feb '03 - 2:40 
Generalerreurmemberskysee2 Dec '02 - 22:03 

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.130516.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