Click here to Skip to main content
12,882,806 members (36,481 online)
Click here to Skip to main content
Articles » Multimedia » OpenGL » General » Downloads


66 bookmarked
Posted 15 Jan 2009

OpenGL MFC AppWizard

, 15 Jan 2009 GPL3
An article showing how to make a Custom AppWizard for OpenGL applictions in Visual Studio .NET 2008
//	DIBSurface.h
//	Copyright (C) Dave Kerr
//	This is an abstaction of a DIB surface.

#pragma once

#include <atlimage.h>

class CDIBSurface
	virtual ~CDIBSurface();

	//	Creation/Destruction
	virtual bool	Create(int nWidth, int nHeight, int nBitCount = 24, void* pData = NULL);
	virtual void	Destroy(bool bHDC = true, bool bHBMP = true);

	//	Image Functions
	void			CreateImage(CImage& image);

	//	Palette / Pixel format
	void			SetPalette(CPalette* pPal);
	virtual bool	SetPixelFormat(int nBitCount);

	//	Diagnostics
	bool			IsValid();

	//	Device context
	CDC*			GetDC() {return m_pDC;}

	//	Drawing
	virtual void	SetPixel(int x, int y, COLORREF cl);
	virtual void	Draw(CDC* pTargetDC, int x, int y);
	virtual void	Draw(HDC hDC, int x, int y);
	virtual void	DrawMapped(CDC* pTargetDC, int x, int y, int cx, int cy);
	virtual void	Erase(COLORREF clColour);

	//	Accessors
	int				GetWidth() const {return;}
	int				GetHeight() const {return;}
	int				GetBitCount() const {return (int)m_byBitCount;}
	void*			GetData() {return m_pBits;}

	//	Member data
	CSize			m_szDIB;
	CDC*			m_pDC;
	HBITMAP			m_hBmp;
	HBITMAP			m_hBmpOld;
	void*			m_pBits;
	BYTE			m_byBitCount;	//	8,16,24 supported.

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.


This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


About the Author

Dave Kerr
Software Developer
United Kingdom United Kingdom
Follow my blog at and find out about my charity at

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170422.1 | Last Updated 15 Jan 2009
Article Copyright 2009 by Dave Kerr
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid