Original Post
Hi... i am currently working on some texture-routines:
// ==================================
// loading routine for pcx''s
bool CTextureFactory::LoadPcx(String Filename, CTexture* &texture)
{
assert(Filename);
FILE *pFile;
pcx_Header_t *pcxPtr;
int imgWidth, imgHeight;
int textureFileLen;
int imgBufferPtr;
int i, j;
unsigned char *pImage;
unsigned char *imgBuffer;
unsigned char *texBuffer;
unsigned char *pcxBufferPtr;
unsigned char *paletteBuffer;
// open File
if((pFile = fopen(Filename, "rb")) == NULL)
{
// faild to open
gLog->Message("File %s was not found", Filename);
return false;
}
...
.. lot of stuff ..
...
// cleanup
delete [] texBuffer;
delete [] paletteBuffer;
delete [] imgBuffer;
// Set infos
texture->width = imgWidth;
texture->height = imgHeight;
texture->bpp = 3;
texture->data = new unsigned char[sizeof(pImage)];
texture->data = pImage;
texture->Name = Filename;
texture->type = GL_RGB;
delete [] pImage;
return true;
}
Now how can i calculate the size of an pointer? Or how can i copy pImage to texture->data? Because my bad way dosen''t work.
Thanks, Austrian Coder