Click here to Skip to main content
12,350,326 members (27,793 online)
Click here to Skip to main content
Articles » Multimedia » OpenGL » General » Downloads

Stats

66.3K views
4.7K downloads
65 bookmarked
Posted

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
{
public:
	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 m_szDIB.cx;}
	int				GetHeight() const {return m_szDIB.cy;}
	int				GetBitCount() const {return (int)m_byBitCount;}
	void*			GetData() {return m_pBits;}

protected:
	//	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.

License

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

Share

About the Author

Dave Kerr
Software Developer
United Kingdom United Kingdom
Follow my blog at www.dwmkerr.com and find out about my charity at www.childrenshomesnepal.org.

You may also be interested in...

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