You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 30, 2019. It is now read-only.
I am trying to transfer code from C++ Sample to C# using SharpDX. Here the code I am using:
// Create the Direct3D 11 API device object and a corresponding context.
// Returns the Direct3D device created.
var d3dDevice = new SharpDX.Direct3D11.Device(SharpDX.Direct3D.DriverType.Hardware, creationFlags, featureLevels);
// Returns feature level of device created.
m_d3dFeatureLevel = d3dDevice.FeatureLevel;
m_d3dDevice = new SharpDX.Direct3D11.Device1(d3dDevice.NativePointer);
m_d3dContext = new SharpDX.Direct3D11.DeviceContext1(d3dDevice.ImmediateContext.NativePointer);
var dxgiDevice = new SharpDX.DXGI.Device(m_d3dDevice.NativePointer);
// Create the Direct2D device object and a corresponding context.
m_d2dDevice = new SharpDX.Direct2D1.Device(m_d2dFactory, dxgiDevice);
m_d2dContext = new SharpDX.Direct2D1.DeviceContext(m_d2dDevice, SharpDX.Direct2D1.DeviceContextOptions.None);
It fails when I try to create m_d2dDevice. In C++ this code is working. Actually they use "As" function to get objects. I have tried to use SharpDX's "As" and it didn't work at all, too.
The text was updated successfully, but these errors were encountered:
You should not use NativePointer at all as you are messing completely COM pointers. This is usually reserved for internal use. There is at least a sample in SharpDX that shows how to initialize Direct2D from Direct3D device, See for example DeviceManager.CreateDeviceResources
:) This is the very similar sample, that I have tried to transfer to the SharpDX. The one that is created by Template in VS2012 for C++.
From: xoofx [mailto:notifications@github.com]
Sent: February 19, 2014 9:00 PM
To: sharpdx/SharpDX
Cc: PavelBrokhman
Subject: Re: [SharpDX] How to create Direct2D Device from Direct3D device? (#286)
You should not use NativePointer at all as you are messing completely COM pointers. This is usually reserved for internal use. There is at least a sample in SharpDX that shows how to initialize Direct2D from Direct3D device, See for example DeviceManager.CreateDeviceResources https://github.com/sharpdx/SharpDX/blob/master/Samples/Win8/CommonDX/DeviceManager.cs#L151
I am trying to transfer code from C++ Sample to C# using SharpDX. Here the code I am using:
// Create the Direct3D 11 API device object and a corresponding context.
// Returns the Direct3D device created.
var d3dDevice = new SharpDX.Direct3D11.Device(SharpDX.Direct3D.DriverType.Hardware, creationFlags, featureLevels);
// Returns feature level of device created.
m_d3dFeatureLevel = d3dDevice.FeatureLevel;
m_d3dDevice = new SharpDX.Direct3D11.Device1(d3dDevice.NativePointer);
m_d3dContext = new SharpDX.Direct3D11.DeviceContext1(d3dDevice.ImmediateContext.NativePointer);
var dxgiDevice = new SharpDX.DXGI.Device(m_d3dDevice.NativePointer);
// Create the Direct2D device object and a corresponding context.
m_d2dDevice = new SharpDX.Direct2D1.Device(m_d2dFactory, dxgiDevice);
m_d2dContext = new SharpDX.Direct2D1.DeviceContext(m_d2dDevice, SharpDX.Direct2D1.DeviceContextOptions.None);
It fails when I try to create m_d2dDevice. In C++ this code is working. Actually they use "As" function to get objects. I have tried to use SharpDX's "As" and it didn't work at all, too.
The text was updated successfully, but these errors were encountered: