directx-11

DirectX::XMMATRIX __declspec(align('16')) won't be aligned

假如想象 提交于 2019-12-04 14:38:20
I am using DirectXMath in building my 3D simulation project void SetConstantBuffer(ID3D11DeviceContext*_device_context, DirectX::XMMATRIX _world, DirectX::XMMATRIX _view, DirectX::XMMATRIX _projection) { ConstantBuffer const_buffer; const_buffer.View = DirectX::XMMatrixTranspose(_world); const_buffer.World = DirectX::XMMatrixTranspose(_view); const_buffer.Projection = DirectX::XMMatrixTranspose(_projection); _device_context->UpdateSubresource(m_const_buffer, 0, NULL, &const_buffer, 0, 0); } I get these kind of compiler errors probably on SIMD flag inside DirectXMath: error C2719: '_world':

DirectX: World to view matrix - where is my misconception?

血红的双手。 提交于 2019-12-04 14:34:04
I'm starting with DirectX (and SharpDX, therefore programming only in C#/hlsl) and am trying to build my own camera class. It should be rotatable, allow forward and backward moving and also "sideways" movement (the classical first person movement often mapped to A and D, plus up and down in my case). For easier bugfixing model and world space are the same in my case, perspective projection is not yet implemented, as is rotating the camera, and my camera is supposed to look in the positive Z-axis (into the screen). My bugfixing model is a simple quad with 1.f width and height, z = 0 and being

DirectX11 2 window rendering

喜你入骨 提交于 2019-12-04 13:51:41
问题 How can I render my objects with DirectX into 2 separated windows? 回答1: You need to create one SwapChain and RenderTargetView for every window. 1 if you created your device via CreateDeviceAndSwapChain you need to obtain IDXGIFactory first IDXGIDevice * device; d3ddevice->QueryInterface(__uuidof(IDXGIDevice), (void**)&device); IDXGIAdapter * adapter; device->GetParent(__uuidof(IDXGIAdapter), (void**)&adapter); IDXGIFactory * factory; adapter->GetParent(__uuidof(DDXGIFactory), (void**)&factory

Copy ffmpeg d3dva texture resource to shared rendering texture

安稳与你 提交于 2019-12-04 13:50:43
I'm using ffmpeg to decode video via d3dva based on this example https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/hw_decode.c . I'm able to succesfully decode video. What I need to do next is to render decoded NV12 frame. I have created directx rendering texture based on this example https://github.com/balapradeepswork/D3D11NV12Rendering and set it as shared. D3D11_TEXTURE2D_DESC texDesc; texDesc.Format = DXGI_FORMAT_NV12; // Pixel format texDesc.Width = width; // Width of the video frames texDesc.Height = height; // Height of the video frames texDesc.ArraySize = 1; // Number of

Resetting window after using DirectX 11

梦想的初衷 提交于 2019-12-04 11:53:48
I've written an application that can switch between OpenGL, DirectX 9 and DirectX 11 for rendering without restarting or recreating the window. Switching between OpenGL and DirectX 9 as well as to DirectX 11 mode works well, however, after using DirectX 11 no other rendering mode works any longer. After releasing all DirectX 11 interfaces, the window still shows the last rendered frame, it is even properly updated when resizing the window. A DirectX 9 device can be created and the Present calls succeed, however, all I see is the last frame drawn by DirectX 11. I’ve used IDXGIDebug:

D3D11: How to draw GDI Text to a GXDI Surface? (Without D2D)

若如初见. 提交于 2019-12-04 10:52:45
问题 I need some help with drawing a text to a texture with GDI and D3D11. I tried using D2D/DirectWrite, but it supports just D3D10 and not D3D11 as I need. Everything I tried failed so far... Now I want to use GDI methodes to write in the texture. So I created a texture with this params: Usage = D3D11_USAGE_DEFAULT; Format = DXGI_FORMAT_B8G8R8A8_UNORM; BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET; CPUAccessFlags = 0; MiscFlags = D3D11_RESOURCE_MISC_GDI_COMPATIBLE Then I

Windows Media Foundation using IMFTransform to decode mp4 movie frames to 2D textures

我的梦境 提交于 2019-12-04 09:47:45
I'm trying to decode an mp4 video using Windows Media Foundation classes and converting frames in to 2D textures that can be used by a DirectX shader for rendering. I've been able to read the source stream using MFCreateSourceReaderfromURL and been able to read the media type of the stream which has its major type MFMEdiaType_Video and minor type as MFVideoFormat_H264 as expected. I'm now needing to convert this format in to an RGB format that could be used to initialise a D3D11_TEXTURE2D resource and resource view which can then be passed to a HLSL pixel shader for sampling. I've tired using

using a custom deleter for std::shared_ptr on a direct3d11 object

与世无争的帅哥 提交于 2019-12-04 08:03:48
When i use an std::shared_ptr and need a custom deleter, i usually make a member function of the object to facilitate it's destruction like this: class Example { public: Destroy(); }; and then when i use the shared ptr, i just make it like this: std::shared_ptr<Example> ptr(new Example, std::mem_fun(&Example::Destroy)); Problem is, right now i'm working with d3d11, and i would like to use the com release functions as an std::shared_ptr custom deleter, like this std::shared_ptr<ID3D11Device> ptr(nullptr, std::mem_fun(&ID3D11Device::Release)); but i get this error: error C2784: 'std::const_mem

DirectX::SpriteFont/SpriteBatch prevents 3D scene from drawing

这一生的挚爱 提交于 2019-12-04 05:27:02
问题 I have a problem using DirectX::SpriteFont / DirectX::SpriteBatch (from DirectXTK; exactly the same problem as discussed here: Problems when drawing text using the SpriteFont class). void DrawScene(void) { HRESULT hr; float bgColor_a[4] = { 0.0f, 0.4f, 0.8f, 0.0f }; g_pDeviceContext->ClearRenderTargetView(g_pRenderTargetView, bgColor_a); g_pDeviceContext->ClearDepthStencilView(g_pDepthStencilView, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0); XMMATRIX cameraProj = XMLoadFloat4x4(&g

Launching SharpDX/DirectX app with DeviceCreationFlags.Debug

你说的曾经没有我的故事 提交于 2019-12-04 05:23:30
问题 I am trying to launch my directX/SharpDX app with DeviceCreationFlags.Debug but i am getting the following crash upon startup: SharpDX.SharpDXException: HRESULT: [0x80004005], Module: [General], ApiCode: [E_FAIL/Unspecified error], Message: Unspecified error at SharpDX.Result.CheckError() at SharpDX.Direct3D11.Device.CreateDevice(Adapter adapter, DriverType driverType, DeviceCreationFlags flags, FeatureLevel[] featureLevels) at SharpDX.Direct3D11.Device..ctor(Adapter adapter,