Click here to Skip to main content
15,886,873 members
Articles / Desktop Programming / MFC

OAG Library (OpenGL) Part 1 - Setting Up the Library for an MFC Application

Rate me:
Please Sign up or sign in to vote.
4.40/5 (11 votes)
7 Aug 2011CPOL3 min read 56.1K   82   56  
OAG is a library written in C++. With this library, you can create OpenGL based applications.
#pragma once

#include "..\..\include\WindowsViewer\WinGraphicContext.h"
#include "..\..\include\oag\OAGScene.h"
#include "..\..\..\Common\include\OAGVector3d.h"
#include "..\..\..\Common\include\OAGMatrix4x4.h"

namespace oag
{
	class WinRenderer
	{
	public:
		WinRenderer(void);
		WinRenderer(oag::WinGraphicContext*  Win32GC, bool b3DMode = false );
		~WinRenderer(void);

	//Attributes
	protected:
		oag::OAGScene*				m_prglScene;
		oag::WinGraphicContext*		m_prglWinGC;
		bool						m_bIs3dMode;
		oag::OAGVector3f			m_VecTranslation;
		oag::OAGVector3f			m_VecScale;
		oag::OAGVector3f			m_VecRotation;
		oag::OAGColor				m_BackGroundColor;

	public:

	//Operations
	public:
		void DeleteCurrentScene();
		bool Is3DMode()							{ return m_bIs3dMode; };
		void GetMatrices(GLdouble *gldModelview, GLdouble *gldProjection);
		void GetOGLPos(const int nXScreenCoordinate, const int nYScreenCoordinate, oag::OAGVector3d* ptOut);
		void GetTranslation(oag::OAGVector3f* vec)	{ vec->SetVertex(m_VecTranslation); };
		void GetRotation(oag::OAGVector3f* vec)	{ vec->SetVertex(m_VecRotation); };
		void GetScale(oag::OAGVector3f* vec)		{ vec->SetVertex(m_VecScale); };
		void SetScene(oag::OAGScene* rglScene)		{ m_prglScene = rglScene; };
		void ScreenToWorld(oag::OAGVector3f ptIn[], oag::OAGVector3d* ptOut, int count);
		void ScreenToWorld(const int nXScreenCoordinate, const int nYScreenCoordinate, double& fXWorldCoordinate, double& fYWorldCoordinate);
		void RenderScene();
		void ResetTransform();
		void SetBackGroundColor(BYTE red, BYTE green, BYTE blue, BYTE alpha = 255){ m_BackGroundColor.SetColor(red, green, blue, alpha); }
		void SetTranslation(float x, float y, float z){ m_VecTranslation.SetVertex(x, y, z);  }
		void SetScale(float x, float y, float z) { m_VecScale.SetVertex(x, y, z);  }
		void SetRotation(float x, float y, float z) { m_VecRotation.SetVertex(x, y, z);  }

	};

};

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 Code Project Open License (CPOL)


Written By
Software Developer
Brazil Brazil
I live in Matão, a small city in Brazil. I studied as Programmer in a College for Software Development in Database.
After finishing the College I have been working with java, c# and Computer Graphics with searches for OpenGL.

Comments and Discussions