Public Group

# Unsure of how to use _com_ptr_t with Directx10

This topic is 3861 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

How do I use the _com_ptr_t with Directx10. I kept having a unhandled exception error during runtime. Here is how I used it:
//Declaring the pointers
_COM_SMARTPTR_TYPEDEF(ID3D10Device, __uuidof(ID3D10Device));

//Usage like a normal COM pointer
ID3D10DevicePtr Device;
ID3D10RenderTargetViewPtr RenderTargetView;
ID3D10RenderDepthStencilViewPtr DepthStencilView;
...

D3DDevice->OMSetRenderTargets(1, &RenderTargetView, DepthStencilView);
...

//Error waw thrown at this line
D3DDevice->ClearRenderTargetView(RenderTargetView, ClearColor);
...

Device->DrawIndexed(36, 0, 0);


The error was due to the RenderTargetView. The error whould occur If I am to do this: D3DDevice->OMSetRenderTargets(1, &RenderTargetView, DepthStencilView); Hoever changing the line to: D3DDevice->OMSetRenderTargets(1, &RenderTargetView.GetInterfacePtr(), DepthStencilView); would solve the problem. Is my guess correct that due to the fact that OMSetRenderTargets() is expecting a array of ID3D10RenderTargetView. Hence it requires the raw pointer to the interface. Is this the correct solution to solving the problem? Or how exactly should I go about using _com_ptr_t with Directx10? Is it possible to use _com_ptr_t with the d3dx10 interfaces? e.g ID3DXThreadPump. When I compiled, VC++ complains that there is no __uuidof(ID3DXThreadPump) for the interface. Thanks

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 17
• 14
• 10
• 9
• 11
• ### Forum Statistics

• Total Topics
634095
• Total Posts
3015501
×