Original Post
Hi, I am trying to display a texture but load it from memory. When I load it from a file (using D3DXCreateTextureFromFileEx) it displays fine, but when I try creating a texture and filling it myself it doesn't display at all. Here's the code bit I use. The data is a 512x512 array of shorts. when I replace these lines with the CreateTextureFromFile call it works fine. Anyone has a hint to help me out ?? D3DXCreateTexture(pd3dDevice, 512, 512, 1, D3DUSAGE_DYNAMIC, D3DFMT_L16, D3DPOOL_DEFAULT, &pTileTexture); D3DLOCKED_RECT lr; if(FAILED( pTileTexture->LockRect( 0, &lr, NULL, D3DLOCK_DISCARD )) ) {... } memcpy( (unsigned short *)lr.pBits, myArray, sizeof(unsigned short) * 512 * 512 ); pTileTexture->UnlockRect( 0 );