Click here to Skip to main content
15,895,462 members
Articles / Multimedia / OpenGL

OAG Library (OpenGL) Part 2.3 - Drawing 2D Textures Using the Mouse and Programatically

Rate me:
Please Sign up or sign in to vote.
4.29/5 (6 votes)
22 Oct 2010CPOL3 min read 34.1K   1.3K   17  
This tutorial shows library code for 2D Textures and how to draw them programatically using the mouse in an MFC application.
#ifndef OAG_OAGREFLECTION_H
#define OAG_OAGREFLECTION_H

#include "..\TextureMapping\OAGRectangleMapping.h"
#include "..\Texture\OAGTextureLoader.h"

namespace oag
{
	class OAGReflection : public oag::OAGObject
	{
	public:
		OAGReflection(void);
		virtual ~OAGReflection(void);

	//Attributes
	protected:
		std::string						m_strMirrorTextureFileName;
		int								m_nMirrorSize;
		oag::OAGRectangleMapping*		m_pRectangleMapping;
		std::vector<oag::OAGObject*>	m_ListObjects;		//Reflection Objects List
	
	//Operations
	private:


	public:

		//Clears the Reflection Objects List but do not delete the objects
		void ClearReflectionList()
		{
			m_ListObjects.resize(0);
		}

		//Sets a Texture with size to a floor
		void SetTextureFloor(oag::OAGTexture* pTexture, int nTextureSize);

		//Sets one object for the reflection
		void AddReflectionObject(oag::OAGObject* pObjReflection)
		{
			m_ListObjects.push_back( pObjReflection ); 
		}

		void DeleteAllReflectionObjects();


		oag::OAGObject* GetObjectAt(int pos)
		{ 
			return m_ListObjects[pos]; 
		}
		
		vector<int>::size_type GetObjectCount()
		{ 
			return m_ListObjects.size();
		}

		oag::OAGRectangleMapping* GetTextureFloor()
		{
			return m_pRectangleMapping;
		}


	//Virtual
	public:

		void AppendChild(oag::OAGNode* pChild){}
		void OnDraw();
		void ReadNodeXML(CXmlNode* pNode);
		void SaveNodeXML(CXmlNode* pNode);

	};
};

#endif //OAG_OAGREFLECTION_H

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