I am in the final stages of porting some code into my framework.
The latest problem is very similar to this one I posted recently (http://stackoverflow...-from-the-usage), whereby text enclosed in '<' and '>' in the listing I am porting code is missing.
The latest offending line is:
[source lang="csharp"]
using (var resource = SlimDX.Direct3D11.Resource.FromSwapChain(swapChain, 0))
renderTarget = new SlimDX.Direct3D11.RenderTargetView(graphics, resource);
[/source]
I get the following error from the compiler:
The type arguments for method 'SlimDX.Direct3D10.Device.OpenSharedResource(System.IntPtr)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
I tried to fix this myself by changing my code to:
using (var resource = SlimDX.Direct3D11.Resource.FromSwapChain<SlimDX.Direct3D11.Resource>(swapChain, 0))
renderTarget = new SlimDX.Direct3D11.RenderTargetView(graphics, resource);
... but now I get an even stranger run-time error:
"Error: Method 'SlimDX.Direct3D11.Resource.FromPointerReflectionThunk' not found."
Initial research indicates I might have stumbled into something which is way above my head: http://www.gamedev.n...interop-expert/
All I am trying to do is port this code into my framework: http://www.aaronblog.us/?p=36 ... which is all about drawing text in SlimDX with DX11.
At some point I hope to have figured out how to genericise this code into my framework. It is heavy going though.
I'm using SlimDX SDK (January 2012).
Two very strange SlimDX DX11 errors
I'm a bit confused.
You say the error is related to 'SlimDX.Direct3D10.Device.OpenSharedResource(System.IntPtr)'
yet you change 'SlimDX.Direct3D11.Resource.FromSwapChain(swapChain, 0)'
Can you show a little more code?
Specifically the part where you obtain and access the shared resource.
You say the error is related to 'SlimDX.Direct3D10.Device.OpenSharedResource(System.IntPtr)'
yet you change 'SlimDX.Direct3D11.Resource.FromSwapChain(swapChain, 0)'
Can you show a little more code?
Specifically the part where you obtain and access the shared resource.
Resource is an abstract class, try using Texture2D
[source lang="csharp"]using (var resource = Resource.FromSwapChain<Texture2D>(swapChain, 0))
{
renderTargetBackBuffer = new RenderTargetView(device, resource);
}[/source]
[source lang="csharp"]using (var resource = Resource.FromSwapChain<Texture2D>(swapChain, 0))
{
renderTargetBackBuffer = new RenderTargetView(device, resource);
}[/source]
Resource is an abstract class, so you can't directly create an instance of it. The method wants you to give it the derived type, in this case probably Texture2D.
EDIT: Ninja-ed!
EDIT: Ninja-ed!
I changeed to
resource = SlimDX.Direct3D11.Resource.FromSwapChain<SlimDX.Direct3D11.Texture2D>(swapChain, 0);
This works fine. Well, I say that, but nothings appearing at the moment so maybe not, but this could be because of some other problem.
Hyunkel - this is more code ported from Aarons shared surface method to draw text. Everything is in place now in exactly the same order but nothing is appearing. I'm currently trying to figure it out. Thanks for the help tho.
resource = SlimDX.Direct3D11.Resource.FromSwapChain<SlimDX.Direct3D11.Texture2D>(swapChain, 0);
This works fine. Well, I say that, but nothings appearing at the moment so maybe not, but this could be because of some other problem.
Hyunkel - this is more code ported from Aarons shared surface method to draw text. Everything is in place now in exactly the same order but nothing is appearing. I'm currently trying to figure it out. Thanks for the help tho.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement