#include "StdAfx.h"
/*
Texture gSavedBG;

void CopyFromBackground( int inX, int inY, int inSizeX, int inSizeY, Texture& ioTex)
{
		// Free the texture
	glDeleteTextures(1, &ioTex.mOpenGLTex);
	glGenTextures(1, &ioTex.mOpenGLTex);

	// get the power-of-2 sizes
	int Width = 1, Height = 1;
	while (Width < inSizeX)
		Width *= 2;
	while (Height < inSizeY)
		Height *= 2;

	ioTex.mScaleX = (float)inSizeX/Width;
	ioTex.mScaleY = (float)inSizeY/Height;
	ioTex.mSizeX = inSizeX;
	ioTex.mSizeY = inSizeY;

	char* theDummy = new char[Width*Height*4];

	// Build The Texture
	glBindTexture(GL_TEXTURE_2D, ioTex.mOpenGLTex);
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
	glTexImage2D(GL_TEXTURE_2D, 0, 4, Width, Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, theDummy);
	delete[] theDummy;

	glCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, inX, eScreenY - inSizeY - inX, inSizeX, inSizeY );
}

void CopyToBackground( int inX, int inY, Texture ioTex)
{
	GLboolean BlendEnable = glIsEnabled(GL_BLEND);
	if ( BlendEnable)
		glDisable(GL_BLEND);

	GLboolean DepthEnable = glIsEnabled(GL_DEPTH_TEST);
	if ( DepthEnable)
		glDisable(GL_DEPTH_TEST);	

	glMatrixMode(GL_PROJECTION);				// Select The Projection Matrix
	glPushMatrix();								// Store The Projection Matrix

	glLoadIdentity();							// Reset The Projection Matrix
	glOrtho(0,eScreenX,0,eScreenY,-1,1);		// Set Up An Ortho Screen

	glMatrixMode(GL_MODELVIEW);					// Select The Modelview Matrix
	glPushMatrix();								// Store The Modelview Matrix
	glLoadIdentity();							// Reset The Modelview Matrix

	glTranslated(0,eScreenY-ioTex.mSizeY,-0.5);			

	glBindTexture(GL_TEXTURE_2D, ioTex.mOpenGLTex);

	glBegin ( GL_QUADS );
	glNormal3f( 0.0f, 0.0f, 1.0f);		
	glTexCoord2f(0, 0);								glVertex3f (0, 0, 0 );
	glTexCoord2f(ioTex.mScaleX, 0);					glVertex3f (ioTex.mSizeX,0, 0 );
	glTexCoord2f(ioTex.mScaleX, ioTex.mScaleY);		glVertex3f (ioTex.mSizeX,ioTex.mSizeY, 0 );
	glTexCoord2f(0, ioTex.mScaleY);					glVertex3f (0,ioTex.mSizeY, 0 );
	glEnd ( );

	glMatrixMode(GL_PROJECTION);				// Select The Projection Matrix
	glPopMatrix();								// Restore The Old Projection Matrix

	glMatrixMode(GL_MODELVIEW);					// Select The Modelview Matrix
	glPopMatrix();
					
	if ( DepthEnable)
		glEnable(GL_DEPTH_TEST);

	if ( BlendEnable)
		glEnable(GL_BLEND);	
}
*/
