ECS/Project/Project/Resources/ResourceData/TextureData/TextureBufferData/TextureBufferData.cpp
//	Initialize the Texture Buffer Data.
Initialize the Texture Buffer Data.
Initialize the Texture Buffer Data .
void TextureBufferData::initializeTextureBufferData(void * newData, const int & newWidth, const int & newHeight, const GLuint & newImageInternalFormat, const GLuint & newImageFormat)
{
	cleanTextureBufferData();
	textureWidth = newWidth;
	textureHeight = newHeight;
	imageInternalFormat = newImageInternalFormat;
	imageFormat = newImageFormat;
	pixelData = new GLubyte[newWidth * newHeight * 4];
	for (int i = 0; i < textureHeight; i++)
	{
		for (int j = 0; j < textureWidth; j++)
		{
			pixelData[((i * textureWidth + j) * 4) + 0] = ((GLubyte *)newData)[((i * textureWidth + j) * 4) + 0];
			pixelData[((i * textureWidth + j) * 4) + 1] = ((GLubyte *)newData)[((i * textureWidth + j) * 4) + 1];
			pixelData[((i * textureWidth + j) * 4) + 2] = ((GLubyte *)newData)[((i * textureWidth + j) * 4) + 2];
			pixelData[((i * textureWidth + j) * 4) + 3] = ((GLubyte *)newData)[((i * textureWidth + j) * 4) + 3];
		}
	}
}
void TextureBufferData :: initializeTextureBufferData ( void * newData , const int & newWidth , const int & newHeight , const GLuint & newImageInternalFormat , const GLuint & newImageFormat ) { cleanTextureBufferData ( ) ; textureWidth = newWidth ; textureHeight = newHeight ; imageInternalFormat = newImageInternalFormat ; imageFormat = newImageFormat ; pixelData = new GLubyte [ newWidth * newHeight * 4 ] ; for ( int i = 0 ; i < textureHeight ; i ++ ) { for ( int j = 0 ; j < textureWidth ; j ++ ) { pixelData [ ( ( i * textureWidth + j ) * 4 ) + 0 ] = ( ( GLubyte * ) newData ) [ ( ( i * textureWidth + j ) * 4 ) + 0 ] ; pixelData [ ( ( i * textureWidth + j ) * 4 ) + 1 ] = ( ( GLubyte * ) newData ) [ ( ( i * textureWidth + j ) * 4 ) + 1 ] ; pixelData [ ( ( i * textureWidth + j ) * 4 ) + 2 ] = ( ( GLubyte * ) newData ) [ ( ( i * textureWidth + j ) * 4 ) + 2 ] ; pixelData [ ( ( i * textureWidth + j ) * 4 ) + 3 ] = ( ( GLubyte * ) newData ) [ ( ( i * textureWidth + j ) * 4 ) + 3 ] ; } } }
Initialize the Texture Buffer Data.
Initialize the Texture Buffer Data .
//	Iterate and copy the pixels from the image.