# where have the shape drawing functions gone in DirectX10?

such as the CreateTeapot function - http://msdn.microsoft.com/en-us/library/windows/desktop/bb172798(v=vs.85).aspx

Is there an equivalent in DX10? If so, how do I use it?

In DX9 you..

Declared:

LPD3DXMESH meshTeapot;


Initialised:

D3DXCreateTeapot(device, &meshTeapot, NULL);


Drew:

meshTeapot->DrawSubset(0);


Released:

meshTeapot->Release();


Is there an equivalent set of methods for drawing primitives? (to be honest the sphere is of more interest to me than the teapot!)

Short Story

Check the DXUT Library under DXSDK_DIR\Samples\C++\DXUT.

Long Story

I'm not entirely sure, but from looking over the documentation it appears that the D3DX utility library has been significantly trimmed between DX9 and DX10. See the following links for a side by side comparison of both libraries:

It seems to me that the shape drawing functions have not been relocated to another portion of the library, but removed entirely instead. You still have mesh support though, using the ID3DX10Mesh interface and the D3DX10CreateMesh function.

With further investigation I managed to find the methods you wanted in the DXUT Library. This is the library used in most of the official DX samples that come with the SDK. I think you should be able to find the library under DXSDK_DIR\Samples\C++\DXUT. In particular check the DXUTShapes.h file which has the following method:

HRESULT WINAPI DXUTCreateSphere(ID3D10Device* pDevice,

3. Finally I can think of yet another solution but I'm not sure I would recommend it as it seems very much like a hack. That alternative would be to initialize a minimal Direct3D 9 device object just so so you can run the D3DXCreateSphere method once, store the data in memory, and then use it later to initialize the Direct3D 10 objects.