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   
QuestionVisual Studio 2005memberjpummill23 Nov '05 - 7:02 
Tried to use this in Visual Studio 2005 with no success. How would one go about upgrading it to work.
 
Thanks for any insight.
AnswerRe: Visual Studio 2005memberbrianpoteat24 Aug '07 - 10:01 
See thread below titled:
"bug fix with Microsoft Visual Studio .NET 2003".
 
There is a fix outlined in there for 2005 as well.
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.
GeneralRe: All I get is a Blank form when I select this as a projectmemberSevenCat15 Dec '03 - 23:44 
Wizard=VsWizard.VsWizardEngine
 
--->
Wizard=VsWizard.VsWizardEngine.7.1
Generalbug fix with Microsoft Visual Studio .NET 2003membermarkthecoder15 May '03 - 21:01 
In the file OGLWiz7.vsz change the first two lines from:
 
VSWIZARD 7.0
Wizard=VsWizard.VsWizardEngine
 
to:
 
VSWIZARD 7.0
Wizard=VsWizard.VsWizardEngine.7.1
 
or else won't work.
 
keep up the good workSmile | :)
 
Markthecoder
GeneralListen to this guy!sussAnonymous4 Jul '03 - 4:33 
Thanks, I was wondering what was going on...
GeneralThanks, what about Microsoft Visual Studio .NET 2005memberceman8228 Jan '07 - 3:03 
In the file OGLWiz7.vsz change the first two lines from:
 
VSWIZARD 7.0
Wizard=VsWizard.VsWizardEngine
 
to:
 
VSWIZARD 7.0
Wizard=VsWizard.VsWizardEngine.8.0
 
and that's it

 
Digitally yours,
CeMan
GeneralRe: Thanks, what about Microsoft Visual Studio .NET 2005membermarkthecoder29 Jan '07 - 13:19 
I think you have to do the same changes in Microsoft Visual Studio .NET 2005Unsure | :~
 
Markthecoder

GeneralIt crashed!memberHALi9 Apr '03 - 21:17 
I'm using the .NET version on Windows XP pro with SP1. I followed the instructions in the readme file, and the wizard icon now appears when i start a new project. But once i press "Ok" Visual Studio .NET crashes and restarts Confused | :confused: . Error details displayed: An unhandled exception has been caught by the VSW exception filter. Any ideas? Thanks.
GeneralRe: It crashed!memberRizwanSattar13 Apr '03 - 5:37 
Hey, I have the exact same problem as you do:
 
If one happened to type the wrong absolute path, then it will show a blank window and then say that the HTML was not found. However, if the correct path IS supplied, then nothing happens for a while and then it crashes. Are we supposed to open the .sln and compile it one time or what?
 
Thanks,
Riz
Generalsome opinions/ideasmemberKoray Balci20 Mar '03 - 23:09 
First of all, it is a very handy tool, I guess it will help me a lot, so thanks a lot.. I just checked the code a little bit and have some comments;
 
1. I would like to have the function comments in doxygen (or JavaDoc) style. if possible..
 
2. When I don't select sample cube in the application, I still have the function GLCube. But it doesn't get called of course. I can delete it, but maybe, you can just get rid of it when I don't select it..
 
3. I am not sure about the performance of timer to show fps. People (including me) use;
__int64 end_count, start_count, dClockFrequency;
QueryPerformanceCounter( (LARGE_INTEGER*)&start_count);
QueryPerformanceFrequency( (LARGE_INTEGER*)&dClockFrequency );
 
/* rendering code here */
 
// FPS calculations again
QueryPerformanceCounter((LARGE_INTEGER*)&end_count);
elapsed_time = (float)(end_count - start_count);
 
float fps = ((float)dClockFrequency / elapsed_time);
 
As far as I remember, timer may not be reliable. I am not really sure though.
 
4. In CApp::FireDrawScene(), do we have to call wglMakeCurrent each frame? I could not experiment with it enough but, looks like it should have a huge performance hit.
 

Thanks again for the great stuff.

QuestionVC++ appwizard??memberSuper Jack15 Jan '03 - 4:38 
Hellow,
I Follow the instructions in the “Readme” file for VS.NET, but when I want to create a new project with your wizard,
after the first step my VS .Net crashes???
 
do i need to import any library's?
 
WTF | :WTF:
AnswerRe: VC++ appwizard??memberUlf Öhlén15 Jan '03 - 6:21 
Crashes?! In what way? Any error messages?
 
--------------
"Aagh!! I'm a victim of a Random Act of Management!"
GeneralRe: VC++ appwizard??memberSuper Jack15 Jan '03 - 23:51 
Thanx for helping me!!
 
The following happens:
- In the Visual c++ projects folder I choose a new OGLWiz (and give it a name)
- when I click on "OK" nothing happens
- after a while (few seconds) I get following bug report:
<<Microsoft Development Environment has encountered a problem and needs to close. We are sorry for the inconvenience.>>
- The data of this report contains:
* Error details: An unhandled exception has been caught by the VSW exception filter.
* Error signature: AppName: devenv.exe AppVer: 7.0.9466.0 ModName: unknown ModVer: 0.0.0.0 Offset: 039a6d28
 

Does this satisfiesWTF | :WTF: or do you need the technical information about the error report.
Maybe it's a stupid fault, but I'm new to C++, VS .net and opengl??
 
greetz Super Jack

GeneralRe: VC++ appwizard??memberbear_16 Jan '03 - 7:18 
I have the same problem. I've followed the installation instructions in readme.txt. Does anybody have a clue what might be wrong?
GeneralRe: VC++ appwizard??memberUlf Öhlén16 Jan '03 - 8:00 
Weird, but I can't find a way to reproduce this error. Tested the wizard on 3 different machines with no problems. If you installed the wizard correctly, maybe it's a language issue. Do you have a localized VS.NET? What edition & build are you using?
 
I did a few Usenet searches on similar errors, and it seems like MS typically gives the suggestion to install the latest service packs for Internet Explorer, multi-language pack and VS.
 
Please let me know if this fixes the problem. Has anyone else seen this?
GeneralRe: VC++ appwizard??memberSuper Jack17 Jan '03 - 6:40 
I have XP professional dutch,
and my VS .NET is english,
I reinstalled VS but njet,
I think i shall use VS 6 instead.
 
Confused | :confused: Eek! | :eek: Dead | X|
 
Greetz Super Jack
GeneralRe: VC++ appwizard??memberhain19 Feb '03 - 6:40 
Same exact behaviour on my machine Cry | :(( (VS.NET, XP Pro, latest service packs, etc., installed). I sure would like a solution, because this looks like a really nice tool!
 
Tom
GeneralRe: VC++ appwizard??memberJM100013 Jun '06 - 4:03 
Same problem. VS.NET 2003, XP Pro, Latest Service pack. Any ideas ??? I'd love to use this tool
 
Jean
GeneralRe: VC++ appwizard??memberKoray Balci20 Mar '03 - 1:57 
I have the same problem. I have installed the tool, and ran it once successfully, i.e. I saw the wizard, but I hit escape, because I had sth else to do... Then, now I have the same behaviour like the others, VC .Net crashes...
 
I have Development Environment 7.0.9466
MS .Net Framework 1.0 Version 1.0.3705
 
in English.. and it says, no update available for my suit.
 
thx..
GeneralRe: VC++ appwizard??membershaul224 Apr '03 - 21:41 
The problem is at the html page of the wizard.
The script in the page tries to set defaults symbols value using the following command:
window.external.SetDefaults(document);
but the html has no SYMBOL tag in it.
 
To fix it, add at least one SYMBOL tag. For example:
(add it in the HEAD section )
<SYMBOL NAME='WIZARD_DIALOG_TITLE' TYPE=text VALUE='TestWizard'></SYMBOL>
 

 
Shaul.
GeneralRe: VC++ appwizard??memberUlf Öhlén15 May '03 - 0:09 
Thanks for the tip, Shaul. I've mailed a bug fix to CodeProject.
 
Sorry for the delay, people. I haven't had much time for hobby projects lately.
 
--------------
"Aagh!! I'm a victim of a Random Act of Management!"
GeneralRe: VC++ appwizard??memberolmec_the_holy11 Sep '03 - 22:57 
i've just ran it perfect in vc++ 5.0
i want you to know all you vc users...
 
onur çobanoğlu
GeneralProblem...memberAli Khanlarkhani12 Jan '03 - 20:30 
Hi,
Thank you for your nice article.Rose | [Rose]
I Follow instruction in the “Readme” file for VS.NET, but when I want to create a new project with your wizard, in the first step I encounter with a blank white screen, and after it I got this error message: Dead | X|
 
Navigation Faild. Cannot Find C:\Program Files\Microsoft Visual Studio.Net\VC7\VCWizards\OGLWiz7\HTML\1033\default.htm
 
What is solution?
 

 

 
Best regards
Ali Khanlarkhani
GeneralRe: Problem...memberUlf Öhlén13 Jan '03 - 4:25 
Sounds like there's an incorrect ABSOLUTE_PATH in the file
"vcprojects\OGLWiz7.vsz". Make sure that ABSOLUTE_PATH points to the folder where you installed the wizard.
 
--------------
"Aagh!! I'm a victim of a Random Act of Management!"
GeneralRe: Problem...memberJyrki Rasku23 Jan '03 - 1:09 
I have same problem. I doublechecked ABSOLUTE_PATH and that was OK. I have installed .NET
in E: drive. could there be a problem?
C: is zip 100
D: is DVD
E: is primary Win XP partition. (Cable Select)
Param="ABSOLUTE_PATH = E:\Program Files\Microsoft Visual Studio .NET\Vc7\VCWizards\OGLWiz7"
 
Any suggestions?
 
--Jyrki

GeneralRe: Problem...memberhain18 Feb '03 - 11:30 
Same here, but I have a standard installation of VS.NET on my C: drive. There must be another problem, but I can't find it! Help?
GeneralRe: Problem...memberSynetech18 Feb '03 - 13:33 
Check the space between Studio and .NET. The default absolute path is "...Visual Studio.NET" where the default VS.NET installation is in "...Visual Studio .NET".

 
--
FireBox @ Synetech

GeneralRe: Problem...memberhain19 Feb '03 - 6:31 
Thanks, that was it. Boy, is my face red... Blush | :O
GeneralRe: Problem...memberUlf Öhlén20 Feb '03 - 2:40 
Hehe, mine tooBlush | :O . Can't believe I missed that...
 
Anyway, since there seem to be a few installtion problems with the .NET version, maybe an installer would be useful? What do you think?
 
--------------
"Aagh!! I'm a victim of a Random Act of Management!"
Generalerreurmemberskysee2 Dec '02 - 22:03 
Cannot include gl.h ?????????????
GeneralRe: erreursussAnonymous2 Dec '02 - 23:04 
Add your include/gl directory to VC++s include path.
 
Or just change the #include statement to gl/gl.h.
GeneralRe: erreurmemberNing Cao29 Aug '03 - 20:57 
Visual C++ 6.0 's standard include path does not contains "gl".
Many programs use
#include
#include
instead of
#include
#include
 
Although we do not regard it as a bug, the code of the wizard may change this feature for convenience of users. Smile | :)
GeneralNice tool!memberMAJOR25 Sep '02 - 19:30 
Its really a nice tool.Laugh | :laugh:
Generalsome problems with itmemberSendel4 Jul '02 - 5:39 
Your Wizard is great but i have some problems with it.
I have a voodoo3 graphicaccelerator. When OpenGL gets initialized this SplashScreen from 3DFX shows me that now the RenderContext is featured by Hardware Acceleration. In your OpenGL Wizard created Application i dont see this splash Screen. So i think it all is rendered with Software...
 
So there must be an error. I am searching for it but i still not found any error...
 
WTF | :WTF: OMG | :OMG: Confused | :confused: Eek! | :eek: Cry | :(( Unsure | :~
GeneralRe: some problems with itmemberUlf Öhlén20 Feb '03 - 3:50 
I haven't tried Voodoo3, but it could be that it can only accelerate some color depths. Try some other value for pfd.cColorBits (16 or 32, probably).
 
You could also check the value of glGetString(GL_VENDOR). If it returns something like "Microsoft Generic", then the software renderer is used.
 
--------------
"Aagh!! I'm a victim of a Random Act of Management!"
GeneralRe: some problems with itmemberSendel20 Feb '03 - 7:47 
Hey cool! Smile | :) I thought you will never reply, so I have forgotten the whole problem and today I have a new Graphic Card (ATI Radeon) and my Voodoo3 is not in use anymore. But thank you for your interest and your time.
 
Confused | :confused: btw. I never found the problem in your wizard, but I think it was a problem of 3dfx. It seems that they have problems with Doublebuffering Unsure | :~ and some combinations of pfd like Stencil Buffer and/or 32bit Color depth...WTF | :WTF:
 
anyway: the problem is solved (new graphic;) card) and I am designing my own OpenGL Applications so i dont need your Wizard anymoreCry | :((
 
But I have to thank you for your great Help: Without your Wizard I would never had found the way to OpenGL !
 
Thank you ! Rose | [Rose] Rose | [Rose] Rose | [Rose] Rose | [Rose] Rose | [Rose] Rose | [Rose] Rose | [Rose] Rose | [Rose] Rose | [Rose]
 
Sendel
GeneralrebootmemberAnonymous20 May '02 - 2:19 
I used this wizard to create the sample application.
I didn't write any line of code, just the one that was generated by your wizard.
It just restart my computer. Why? What can I do?
OMG | :OMG:
GeneralRe: rebootmemberC++25 Feb '03 - 19:46 
If you are using Windows Xp the reebot is caused by an "System error"
 
People say that I am a perverse person, but are not truth because I have the heart of a boy.... I have it in a bottle with formol in my writing-desk.
GeneralGreat!memberrajbow30 Jan '02 - 0:32 
this is really good...
but gl includes are generated wrongly in the binary
change it to
gl/gl.h and gl/glu.h
 
Smile | :) and i also have a gift for u have this:Rose | [Rose]
GeneralRe: Great!memberSendel4 Jul '02 - 10:14 
there is one problem more: read above...
Cry | :(( Eek! | :eek: WTF | :WTF: OMG | :OMG:

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