Question

I have created a project that runs on Windows Phone 8 that uses the template Direct3D With XAML provided by the Windows Phone SDK. I have also incorporated DirectXTK and declared a std::unique_ptr<DirectX::SpriteBatch> m_SB; in the CubeRenderer.h

When I try to assign it in the function CreateDeviceResources thus:

m_SB.reset(new SpriteBatch(m_d3dContext.Get()));

it gives the error: An unhandled exception of type 'System.AccessViolationException' occurred in Unknown Module.

I do not know why this is. This works perfectly if I create the project with the Direct3D (Native) template.

Any help would be appreciated.

Was it helpful?

Solution

You have to put the code inside the CreateWindowSizeDependentResources function, then it should work fine.

Source

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top