Click here to Skip to main content
15,881,667 members
Articles / Multimedia / OpenGL

OpenGL Win32 AppWizard

Rate me:
Please Sign up or sign in to vote.
4.97/5 (45 votes)
19 May 20033 min read 484.8K   22.7K   115  
This Custom AppWizard for VC++ 6.0 or VC++.NET creates an OpenGL enabled Win32 application suitable for demos and simple games.
// OGLWizaw.cpp : implementation file
//

#include "stdafx.h"
#include "OGLWiz.h"
#include "OGLWizaw.h"
#include "chooser.h"

#ifdef _PSEUDO_DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

// This is called immediately after the custom AppWizard is loaded.  Initialize
//  the state of the custom AppWizard here.
void COGLWizAppWiz::InitCustomAppWiz()
{
	// Create a new dialog chooser; CDialogChooser's constructor initializes
	//  its internal array with pointers to the steps.
	m_pChooser = new CDialogChooser;

	// Set the maximum number of steps.
	SetNumberOfSteps(LAST_DLG);

	// TODO: Add any other custom AppWizard-wide initialization here.
}

// This is called just before the custom AppWizard is unloaded.
void COGLWizAppWiz::ExitCustomAppWiz()
{
	// Deallocate memory used for the dialog chooser
	ASSERT(m_pChooser != NULL);
	delete m_pChooser;
	m_pChooser = NULL;

	// TODO: Add code here to deallocate resources used by the custom AppWizard
}

// This is called when the user clicks "Create..." on the New Project dialog
//  or "Next" on one of the custom AppWizard's steps.
CAppWizStepDlg* COGLWizAppWiz::Next(CAppWizStepDlg* pDlg)
{
	
	return m_pChooser->Next(pDlg);
}

// This is called when the user clicks "Back" on one of the custom
//  AppWizard's steps.
CAppWizStepDlg* COGLWizAppWiz::Back(CAppWizStepDlg* pDlg)
{
	// Delegate to the dialog chooser
	return m_pChooser->Back(pDlg);
}

void COGLWizAppWiz::CustomizeProject(IBuildProject* pProject)
{
	using namespace DSProjectSystem;

	long lNumConfigs;
	IConfigurationsPtr pConfigs;
	IBuildProjectPtr pProj;
	CString sTemp;
	// Needed to convert IBuildProject to the DSProjectSystem namespace
	pProj.Attach((DSProjectSystem::IBuildProject*)pProject, true);

	pProj->get_Configurations(&pConfigs);
	pConfigs->get_Count(&lNumConfigs);
	//Get each individual configuration
	for (long j = 1 ; j < lNumConfigs+1 ; j++)
	{
		_bstr_t varTool;
		_bstr_t varSwitch;
		IConfigurationPtr pConfig;
		_variant_t varj = j;

		pConfig = pConfigs->Item(varj);

		varTool = "link.exe";
		if(OGLWizaw.m_Dictionary.Lookup("opengl", sTemp))
			varSwitch = "User32.lib Gdi32.lib opengl32.lib glu32.lib";
		else
			varSwitch = "User32.lib Gdi32.lib";
		pConfig->AddToolSettings(varTool, varSwitch, varj);
	}   
}


// Here we define one instance of the COGLWizAppWiz class.  You can access
//  m_Dictionary and any other public members of this class through the
//  global OGLWizaw.
COGLWizAppWiz OGLWizaw;

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

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


Written By
Sweden Sweden
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions