directx

Access floats of XMMatrix - () operator not working

折月煮酒 提交于 2019-12-12 12:16:10
问题 I'm trying to do some 3D stuff in DirectX (I'm migrating from OpenGL) and I've hit a snag. I want to access the values of an XMMATRIX and looking at the Microsoft documentation there should be an () operator: float& operator ()( size_t Row, size_t Column ); So I tried using as such: XMMATRIX i = XMMatrixIdentity(); float j = i(0,0); But Intellisense gives me the error: IntelliSense: call of an object of a class type without appropriate operator() or conversion functions to pointer-to-function

Sampling from a texture which is also a render target

回眸只為那壹抹淺笑 提交于 2019-12-12 11:41:02
问题 I know this technically isn't supported (and as far as I can tell it's undefined behavior) but is it really a fatally horrible thing to sample from a texture which is also being written to? I ask because I need to read from a depth texture which I also need to write to, if I can't do this it means I will have to copy the depth texture and if it isn't that big of a deal I don't see the harm in simply copying it? Thanks for any help! 回答1: Yes, it's fatal and triggers undefined behaviour. Just

Creating Texture Programmatically DirectX

混江龙づ霸主 提交于 2019-12-12 11:35:50
问题 I am trying to create a white 20 x 20 pixel square on the screen by providing an array of rgba values, creating a ID3D11Texture2D resource with that array, and then mapping it to my 20 x 20 square. Here is the code for creating the square texture, and the Shader Resource View: void Square::CreateSquareTexture(float *color) { float *texArray = (float *)malloc(4 * 20 * 20 * sizeof(float)); for (int i = 0; i < 20 * 20 * 4; i++) texArray[i] = 1.0f; ID3D11Texture2D *boxTex = 0; D3D11_TEXTURE2D

Should I use integer ID or pointers for my opaque objects?

烂漫一生 提交于 2019-12-12 11:01:50
问题 I'm writing an abstraction layer on top of some graphics API (DirectX9 and DirectX11) and I would like your opinion. Traditionally I would create a base class for each concept I want to abstract. So in typical OO fashion I would have for example a class Shader and 2 subclasses DX9Shader and DX11Shader. I would repeat the process for textures, etc... and when I need to instantiate them I have an abstract factory that will return the appropriate subclass depending on the current graphics API.

DirectX Screen Capture - Desktop Duplication API - limited frame rate of AcquireNextFrame

狂风中的少年 提交于 2019-12-12 09:26:45
问题 I'm trying to use Windows Desktop Duplication API to capture the screen and save the raw output to a video. I'm using AcquireNextFrame with a very high timeout value (999ms). This way I should get every new frame from windows as soon as it at has one, which naturally should be at 60fps anyway. I end up getting sequences where everything looks good (frame 6-11), and then sequences where things look bad (frame 12-14). If I check AccumulatedFrames lFrameInfo.AccumulatedFrames the value is often

Calculating screen texture coordinates in CG/HLSL

纵然是瞬间 提交于 2019-12-12 09:13:24
问题 In OpenGL , sometimes when doing multi-pass rendering and post-processing I need to apply texels to the primitive's assembly fragments which are part of full screen texture composition.That is usually the case when the current pass comes from FBO texture to which the screen quad had been rendered during previous pass.To achieve this I calculate objects UV coordinates in SCREEN SPACE .In GLSL I calculate it like this: vec2 texelSize = 1.0 / vec2(textureSize(TEXTURE, 0)); vec2 screenTexCoords =

Cannot open file 'dxguid.lib'

≯℡__Kan透↙ 提交于 2019-12-12 08:55:00
问题 I'm having annoying linker issues - VS2010 claims it cannot find this file, but it's clearly there, and the path is correct - I'm using other lib's in the same folder that all work no problem. (d3d9.lib, and dinput8.lib) I'm using the February 2010 version of DXSDK (DX9) in case that's relevant. I've even tried copy/pasting the file name so I know I didn't mis-type it. My "Additional Dependencies" line looks like this: Library.lib;d3d9.lib;dinput8.lib;dxguid.lib;%(AdditionalDependencies) and

Multiple Render Targets not saving data

折月煮酒 提交于 2019-12-12 08:13:19
问题 I'm using SlimDX, targeting DirectX 11 with shader model 4. I have a pixel shader "preProc" which processes my vertices and saves three textures of data. One for per-pixel normals, one for per-pixel position data and one for color and depth (color takes up rgb and depth takes the alpha channel). I then later use these textures in a postprocessing shader in order to implement Screen Space Ambient Occlusion, however it seems none of the data is getting saved in the first shader. Here's my pixel

Rendering from WPF's internals to a Directx application

て烟熏妆下的殇ゞ 提交于 2019-12-12 07:57:41
问题 I have a WPF application that is intended for overlaying a HUD in a live stream. The original idea was to create a plugin for xsplit (a popular application for presenting live streams) to display the content of the WPF application. The problem with this approach is that rendering a bitmap to the COM interface of xsplit is far to damaging in CPU performance to release the application (As I believe there are issues in xsplit's COM interface as well as using RenderTargetBitmap taxing the CPU). I

SlimDX Device.Reset crashes with a “D3DERR_INVALIDCALL: Invalid call (-2005530516)” error

末鹿安然 提交于 2019-12-12 07:19:32
问题 We recently upgraded from VS 2005 to VS 2008 (Windows XP). We use SlimDx in one of our projects. All was working ok after the upgrade, except my Recover function, which gets called on devicelost/device reset which crashes with D3DERR_INVALIDCALL: Invalid call (-2005530516) I use Ctrl - Alt - Del and then Escape to simulate device lost. void Recover() { try { if (res.Code == D3DERR_DEVICENOTRESET) { res = m_device.Reset(m_presentParams); //Crashes on this. if (res.IsSuccess) { m_deviceLost =