• Advertisement
Sign in to follow this  

Unsure of how to use _com_ptr_t with Directx10

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

If you intended to correct an error in the post then please contact us.

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

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement