directx-11

Vertex Shader Creating

别等时光非礼了梦想. 提交于 2019-12-12 01:37:07
问题 I am learning D3D and currently i am at shaders. I wrote the code and built it - succeed but when debug i get this error: ERROR Here is the line where debugger breake: dev->CreateVertexShader(VS->GetBufferPointer(), VS->GetBufferSize(), NULL, &pVS); And here is the whole function: void InitPipeline() { // load and compile the two shaders ID3D10Blob *VS, *PS; D3DX11CompileFromFile("Shaders.shader", 0, 0, "VShader", "vs_4_0", 0, 0, 0, &VS, 0, 0); D3DX11CompileFromFile("Shaders.shader", 0, 0,

DirectX 11 Vertices Coordinates

依然范特西╮ 提交于 2019-12-12 01:01:36
问题 I'm working on my first C++ and DirectX 11 project where my current goal is to draw a colored triangle on the screen. This has worked well without any problems. However, there's one part that I would like to change, but I don't know how. I've tried searching for a solution but I havn't found any yet, and I guess that the reason is because I don't really know what I should search for. Currently I set up my triangles 3 vertices like this: VertexPos vertices[] = { { XMFLOAT3( 0.5f, 0.5f, 1.0f )}

DirectX 11: Model not rendering from Model class

好久不见. 提交于 2019-12-11 18:08:01
问题 Ok! Here goes. I've updated my code. However, after hours of debugging seemingly perfect code, I can't spot the problem. I've set up multiple breakpoints around the Vertex and Index buffer creation, and the class draw call. I've created a temporary vtest struct for the purposes of testing. It carries the definition. struct vtest{ XMFLOAT3 Vertex; XMFLOAT4 Color; }; Linked to a proper IA abstraction: D3D11_INPUT_ELEMENT_DESC InputElementDesc[] = { { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT,

Resizing Texture before sending to SinkWriter SharpDX

心已入冬 提交于 2019-12-11 17:32:06
问题 I'm working on Screen recording application. My problem is I need to resize the Texure2d before making sample using CreateDXGISurfaceBuffer. I'm new with Mediafoundation and upon reading the documentation I couldn't find any sample code from the website. I'm using IDXGIOutput1::DuplicateOutput to get the screen texture. Is there a better way to resize the texture without suffering the performance? 回答1: Video Processor MFT can scale your textures. When you use it in Direct3D 11 enabled mode,

Transparency on two rectangles in DirectX, one behind another - I see the background of window instead the second texture

放肆的年华 提交于 2019-12-11 13:55:56
问题 I have an DirectX 11 C++ application that displays two rectangles with textures and some text. Both textures are taken from TGA resources (with alpha channel added). When I run the program, I get the result: What's wrong? Take a closer look: The corners of the rectangles are transparent (and they should be). The rest of textures are set to be 30% opacity (and it works well too). But, when one texture (let's call it texture1 ) is over another ( texture2 ): The corners of texture1 are

16 byte alignment issue

馋奶兔 提交于 2019-12-11 13:53:58
问题 I am using DirectXMath , creating XMMatrix and XMVector in classes. When I call XMMatrixMultiply it throws unhandled exception on it. I have found online that it is an issue with byte alligment, since DirectXMath uses SIMD instructions set which results in missaligned heap allocation. One of the proposed solution was to use XMFLOAT4X4 variables and then change them to temporary XMMatrix whenever needed, but it isn't the nicest and fastest solution imo. Another one was to use _aligned_malloc ,

Use specified font with directx-11

大城市里の小女人 提交于 2019-12-11 12:34:47
问题 I would like to use a specified font file with DirectX 11 After searching, i am stuck to create a custom Font Collection. Code to load the specified font file: Platform::String^ pathTEST; Microsoft::WRL::ComPtr<IDWriteFontFile> fontFileTEST; Microsoft::WRL::ComPtr<IDWriteFontFileLoader> fontFileLoaderTEST; Windows::Storage::StorageFolder^ folder = Windows::Storage::ApplicationData::Current->LocalFolder; pathTEST = folder->Path + L"\\Bubblegum.ttf";//#BubbleGum HRESULT hr = S_OK; if (SUCCEEDED

Down Casting ID3D11Texture2D

你。 提交于 2019-12-11 11:37:49
问题 According to the documentation http://msdn.microsoft.com/en-us/library/windows/desktop/ff476635(v=vs.85).aspx ID3D11Texture2D inherits from the ID3D11Resource. I tried the following but it gives a std:non-rtti exception. ID3D11Texture2D *tex2d = dynamic_cast<ID3D11Texture2D*>(resource); 回答1: Since ID3D11Texture2D is a COM interface you should use QueryInterface to get other interfaces the object might support. Something like this: HRESULT hr = resource->QueryInterface(IID_ID3D11Texture2D,

destroy directx device and swap chain

雨燕双飞 提交于 2019-12-11 11:12:55
问题 I am encountering a strange issue I think involves D3D11CreateDeviceAndSwapChain I can create the device and swap chain however when the application exits and ->destroy gets called on the swap chain, device, and device context a thread is still running. Commenting out this line the application terminates as expected. featureLevel = D3D_FEATURE_LEVEL_11_0; result = D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, &featureLevel, 1, D3D11_SDK_VERSION, &swapChainDesc, &m

Odd behaviour when trying to create triangle using TriangleStrip Topologu

∥☆過路亽.° 提交于 2019-12-11 11:01:49
问题 I tried to create this 2D triangle in with the Input Assembler set to triangle strip: 1.(0.0f, 0.0f, 0.5f) 2.(-0.5f, 0.0f, 0.5f) 3.(-0.5f, -0.5f, 0.5f) However, no triangle was drawn, in fact nothing was drawn on the render target, not even a single line. I messed around, and then I swapped coordinates 2 and 3 , and it worked. The triangle was drawn just as I intended it to be. What is the reason for this odd behaviour? 回答1: You define your vertex in counter-clockwise order, and Direct3D will