ECS/Project/Project/Renderers/RendererResourceManagers/RendererTextureManager/RendererTextureManager.cpp
//	Add the Texture to the Renderer Texture Manager.
Add the Texture to the Renderer Texture Manager.
Add the Texture to the Renderer Texture Manager .
void RendererTextureManager::addTexture(std::string newTextureName, std::shared_ptr<const TextureData> newTextureData)
{
	std::shared_ptr<RendererTextureData> newRendererTextureData = std::make_shared<RendererTextureData>();
	newRendererTextureData->textureType = newTextureData->getTextureType();
	newRendererTextureData->textureWidth = newTextureData->viewTextureBufferData(0)->getWidth();
	newRendererTextureData->textureHeight = newTextureData->viewTextureBufferData(0)->getHeight();
	if (newRendererTextureData->textureType == GL_TEXTURE_2D)
	{
		Generate the New Texture.
		glGenTextures(1, &newRendererTextureData->textureID);
		Bind it to the appropriate location.
		glBindTexture(GL_TEXTURE_2D, newRendererTextureData->textureID);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
		Set the Texture parameters.
		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, newTextureData->viewTextureBufferData(0)->getWidth(), newTextureData->viewTextureBufferData(0)->getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, newTextureData->viewTextureBufferData(0)->viewTextureBufferData());
		Bind it to the appropriate location.
		glBindTexture(GL_TEXTURE_2D, 0);
	}
	else if (newRendererTextureData->textureType == GL_TEXTURE_CUBE_MAP)
	{
		Generate the New Texture.
		glGenTextures(1, &newRendererTextureData->textureID);
		Bind it to the appropriate location.
		glBindTexture(GL_TEXTURE_CUBE_MAP, newRendererTextureData->textureID);
		for (int i = 0; i < 6; i++)
		{
			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGBA, newTextureData->viewTextureBufferData(i)->getWidth(), newTextureData->viewTextureBufferData(i)->getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, newTextureData->viewTextureBufferData(i)->viewTextureBufferData());
		}
		glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
		glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
		glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
		glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
		glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
		glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
	}
 	mapNameToTextureData[newTextureName] = newRendererTextureData;
}
void RendererTextureManager :: addTexture ( std :: string newTextureName , std :: shared_ptr < const TextureData > newTextureData ) { std :: shared_ptr < RendererTextureData > newRendererTextureData = std :: make_shared < RendererTextureData > ( ) ; newRendererTextureData -> textureType = newTextureData -> getTextureType ( ) ; newRendererTextureData -> textureWidth = newTextureData -> viewTextureBufferData ( 0 ) -> getWidth ( ) ; newRendererTextureData -> textureHeight = newTextureData -> viewTextureBufferData ( 0 ) -> getHeight ( ) ; if ( newRendererTextureData -> textureType == GL_TEXTURE_2D ) { glGenTextures ( 1 , & newRendererTextureData -> textureID ) ; glBindTexture ( GL_TEXTURE_2D , newRendererTextureData -> textureID ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_WRAP_S , GL_REPEAT ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_WRAP_T , GL_REPEAT ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MAG_FILTER , GL_LINEAR ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MIN_FILTER , GL_LINEAR ) ; glTexImage2D ( GL_TEXTURE_2D , 0 , GL_RGBA , newTextureData -> viewTextureBufferData ( 0 ) -> getWidth ( ) , newTextureData -> viewTextureBufferData ( 0 ) -> getHeight ( ) , 0 , GL_RGBA , GL_UNSIGNED_BYTE , newTextureData -> viewTextureBufferData ( 0 ) -> viewTextureBufferData ( ) ) ; glBindTexture ( GL_TEXTURE_2D , 0 ) ; } else if ( newRendererTextureData -> textureType == GL_TEXTURE_CUBE_MAP ) { glGenTextures ( 1 , & newRendererTextureData -> textureID ) ; glBindTexture ( GL_TEXTURE_CUBE_MAP , newRendererTextureData -> textureID ) ; for ( int i = 0 ; i < 6 ; i ++ ) { glTexImage2D ( GL_TEXTURE_CUBE_MAP_POSITIVE_X + i , 0 , GL_RGBA , newTextureData -> viewTextureBufferData ( i ) -> getWidth ( ) , newTextureData -> viewTextureBufferData ( i ) -> getHeight ( ) , 0 , GL_RGBA , GL_UNSIGNED_BYTE , newTextureData -> viewTextureBufferData ( i ) -> viewTextureBufferData ( ) ) ; } glTexParameteri ( GL_TEXTURE_CUBE_MAP , GL_TEXTURE_MAG_FILTER , GL_LINEAR ) ; glTexParameteri ( GL_TEXTURE_CUBE_MAP , GL_TEXTURE_MIN_FILTER , GL_LINEAR ) ; glTexParameteri ( GL_TEXTURE_CUBE_MAP , GL_TEXTURE_WRAP_S , GL_CLAMP_TO_EDGE ) ; glTexParameteri ( GL_TEXTURE_CUBE_MAP , GL_TEXTURE_WRAP_T , GL_CLAMP_TO_EDGE ) ; glTexParameteri ( GL_TEXTURE_CUBE_MAP , GL_TEXTURE_WRAP_R , GL_CLAMP_TO_EDGE ) ; glBindTexture ( GL_TEXTURE_CUBE_MAP , 0 ) ; } mapNameToTextureData [ newTextureName ] = newRendererTextureData ; }
Add the Texture to the Renderer Texture Manager.
Add the Texture to the Renderer Texture Manager .
//	Renderer Texture Data. //	 //	Generate the New Texture. //	Bind it to the appropriate location. // //	Set the Texture parameters. //	Bind it to the appropriate location. //	Generate the New Texture. //	Bind it to the appropriate location. //	 // //	