directx-11

Using Media Foundation to encode Direct X surfaces

六月ゝ 毕业季﹏ 提交于 2019-12-20 11:30:59
问题 I'm trying to use the MediaFoundation API to encode a video but I'm having problems pushing the samples to the SinkWriter. I'm getting the frames to encode through the Desktop Duplication API. What I end up with is an ID3D11Texture2D with the desktop image in it. I'm trying to create an IMFVideoSample containing this surface and then push that video sample to a SinkWriter. I've tried going about this in different ways: I called MFCreateVideoSampleFromSurface(texture, &pSample) where texture

What is the best practice to render sprites in DirectX 11?

亡梦爱人 提交于 2019-12-20 10:23:38
问题 I am currently trying to get used to the DirectX API and I am wondering what is the usual approach to render a sprite in DirectX 11 (e.g. for a tetris clone). Is there a simmilar interface as ID3DX10Sprite , and if not, which would be the usual method to draw sprites in DirectX 11? Edit: Here is the HLSL code that worked for me (the computation of the projection coordinate could be done better): struct SpriteData { float2 position; float2 size; float4 color; }; struct VSOut { float4 position

What's the difference between WARP drivers,reference drivers and software drivers?

喜你入骨 提交于 2019-12-20 05:58:02
问题 In DirectX 11, there are four types of drivers: D3D_DRIVER_TYPE_HARDWARE D3D_DRIVER_TYPE_REFERENCE D3D_DRIVER_TYPE_SOFTWARE D3D_DRIVER_TYPE_WARP The first one is hardware driver which is widely known to us. and we always use this one in our program. The last 3 are WARP dirver, reference driver and software driver. from the document on MSDN, I am not quite clear what's the differences of the 3 kinds of drivers, the same is they are all implement by software, but, what's the differences? 回答1:

DirectX Camera to follow based on 3D Model's world Matrix?

给你一囗甜甜゛ 提交于 2019-12-20 05:41:43
问题 I have multiple objects moving about in a 3D space and am looking for ways to, on button press, have the camera snap and follow the object chosen. Is there a way to make use of each object's worldMatrix? (Below is an example of one object. This one is a planet that spins & orbits) //set up matrices for rendering D3DXMATRIX worldMatrixMer, viewMatrixMer, projectionMatrixMer; m_Camera->GetViewMatrix(viewMatrixMer); m_D3D->GetWorldMatrix(worldMatrixMer); m_D3D->GetProjectionMatrix

error X3000: Illegal character in shader file

给你一囗甜甜゛ 提交于 2019-12-19 18:17:29
问题 I pasted a line of shader code from SO and now my project refuses to work. I removed the tainted line of code. I've re-written the shader multiple times from scratch using VS, Notepad and Notepad++ as suggested on the Unity forums. I've used the hex editor view in Notepad++ to rule out the first two bytes aren't 0xFE 0xFF as suggested on this gamedev question. I really can't figure this one out. I'm grateful for any suggestions you might have. cbuffer CB_PER_FRAME : register(b0) { column

D3D11: How to draw a simple pixel aligned line?

柔情痞子 提交于 2019-12-19 02:56:04
问题 I tried to draw a line between two vertices with D3D11. I have some experiences in D3D9 and D3D11, but it seems to be a problem in D3D11 to draw a line, which starts in one given pixel and ends in an other. What I did: I added 0.5f to the pixel coordinates of each vertex to fit the texel-/pixel coordinate system (I read the Microsoft pages to the differeces between D3D9 and D3D11 coordinate systems): f32 fOff = 0.5f; ColoredVertex newVertices[2] = { { D3DXVECTOR3(fStartX + fOff, fStartY +

How to create bitmap from Surface (SharpDX)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-18 13:35:06
问题 I am new to DirectX and trying to use SharpDX to capture a screen shot using the Desktop Duplication API. I am wondering if there is any easy way to create bitmap that I can use in CPU (i.e. save on file, etc.) I am using the following code the get the desktop screen shot: var factory = new SharpDX.DXGI.Factory1(); var adapter = factory.Adapters1[0]; var output = adapter.Outputs[0]; var device = new SharpDX.Direct3D11.Device(SharpDX.Direct3D.DriverType.Hardware, DeviceCreationFlags

Can't create Direct2D DXGI Surface

夙愿已清 提交于 2019-12-18 09:23:53
问题 I'm calling this method: http://msdn.microsoft.com/en-us/library/dd371264(VS.85).aspx The call fails with E_NOINTERFACE . The documentation is especially unhelpful as to why this may happen. I've enabled all of the DirectX 11 debug stuff and that's the best I got. I know that I have a valid IDXGISurface1* (also tried IDXGISurface ) and the other parameters are set correctly. Any ideas as to why this call may fail? Edit: I also am having problems creating D3D11 devices. If I pass nullptr as

DirectX 11 framebuffer capture (C++, no Win32 or D3DX)

我的未来我决定 提交于 2019-12-17 17:58:18
问题 I would like to capture the contents of my front or back buffer using DirectX 11 into an array of bytes which I can then use as a texture or as a source for creating a file. I have a swap chain setup, lots of rendering happening and the following code so far - which I make sure to call after the call to Present. ID3D11Texture2D* pSurface; HRESULT hr = m_swapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), reinterpret_cast< void** >( &pSurface ) ); if( pSurface ) { const int width = static

find out which polygon were front facing (drawn) after the rasterization stage

ぐ巨炮叔叔 提交于 2019-12-13 18:25:22
问题 I want to be able to access the polygon id (PrimitiveID) of the the front facing polygons of a mesh. I can only see this happening after the rasterizer stage, in the pixel shader. I was thinking about creating an append buffer but since the pixel shader is executed multiple times it might append the same polygon id more than once. I also thought about creating an array boolean variables and using the primitive id from the input assembler stage in the pixel shader as an index and set it to