This is what the model looks like textured with my loader using the actual image data
Using D3DXfunction after converting it to PNG
Here is the code to load the data into the texture, I wrote a small win32 image viewer to check if the image data is loaded properly, and it is. So I believe it's something in this loading code >
//create texture
IDirect3DTexture9* tempTexture = 0;
HRESULT hr = device->CreateTexture(this->width,this->height,0,D3DUSAGE_DYNAMIC,D3DFMT_A8R8G8B8,D3DPOOL_DEFAULT,&tempTexture,0);
//assignment pointer
D3DCOLOR *Ptr;
unsigned char *tempPtr = 0; // increment pointer
int count = 0; //index into color data
//lock texture and get ptr
D3DLOCKED_RECT rect;
hr = tempTexture->LockRect(0,&rect,0,D3DLOCK_DISCARD);
tempPtr = (unsigned char*)rect.pBits; //assign to unsigned char pointer to make pointer arithmetic smooth
for(unsigned int i = 0; i < this->height; i++)
{
tempPtr += rect.Pitch; //move to next line in texture
Ptr = (D3DCOLOR*)tempPtr;
for(unsigned int j = 0; j < this->width; j++)
{
Ptr[j] = D3DCOLOR_XRGB(this->imageData[count++],this->imageData[count++],this->imageData[count++]);
}
}
tempTexture->UnlockRect(0);
return tempTexture;