• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# Need help with CreateTexutre

## Recommended Posts

I can't seem to get this to work for any reason whatsoever.
  HRESULT returnvalue; IDirect3DSurface8 *BitmapTexture; returnvalue = d3dDevice->CreateTexture(32, 32, 0, 0, D3DFMT_X8R8G8B8, D3DPOOL_MANAGED, &BitmapTexture); 
The problem is, returnvalue always returns with a value of D3DERR_INVALIDCALL. I know the device is working correctly because if I use D3DXCreateTexture it works, but I don't want to use the D3DX library. Edited by - Nytegard on August 3, 2001 9:01:54 AM

##### Share on other sites
From the docs of D3DXCreateTexure:
Remarks:
Internally, D3DXCreateTexture uses D3DXCheckTextureRequirements to adjust the calling parameters. Therefore, calls to D3DXCreateTexture will often succeed where calls to IDirect3Ddevice8::CreateTexture would fail.

So this means that if you call D3DXCT with D3DFMT_X8R8G8B8 the created texture does not have to be in this format (to get the format use the GetLevelDesc method). Use CheckDeviceFormat to ensure your selected format is supported by the device.

Bjørn.

##### Share on other sites
CheckDeviceFormat returned D3D_OK when I passed D3DFMT_X8R8G8B8.
I''m using this on a GeForce 3, and I''m pretty sure it accepts this value even without CheckDeviceFormat.

Guess it''s time to try switching video drivers and see if that fixes the problem.

##### Share on other sites
Ok, as the AP mentioned in the other thread use IDirect3DTexture8 instead of IDirect3DSurface8.

Bjørn.