directx

DirectX Crash When Resizing Tiny

家住魔仙堡 提交于 2019-12-11 05:23:19
问题 I am trying to make my program more bullet proof. My program resizes fine until I make it super tiny like this: A method to prevent that from happening is to set a minimum size, which I know how to do already. I want to look deeper into the problem before I do that. The following is where the functions start to crash. hr=swapChain->ResizeBuffers(settings.bufferCount, settings.width, settings.height, DXGI_FORMAT_UNKNOWN, 0); if(FAILED(hr)) return 0; I figured it was because the buffer was too

Capture and draw a screenshot using directX

被刻印的时光 ゝ 提交于 2019-12-11 05:14:48
问题 I am trying to get DirectX (DX9) to grab a screenshot of the desktop and immediately draw it back out (in smaller dimensions) to my form. I have DirectX working to the capacity that the device is created along with a few surfaces and I can render them to screen. I am using one surface F3F3Surf9_SS to get the desktop Screenshot. Here is my declaration and initialization of varaibles F3D3Surf9_SS : IDirect3DSurface9; //Surface SS F3D3Surf9_A : IDirect3DSurface9; //Surface A F3D3Surf9_B :

Different options to handle mouse and keyboard input in a game

拈花ヽ惹草 提交于 2019-12-11 04:35:11
问题 I've recently been getting into DirectX and along with that, game programming. I've started fleshing out my base of the program and now I'm looking to get into handling input. The way I have right now is through calling a function in my main loop which queries the mouse and keyboard using GetDeviceState (in a nutshell) and their respective arguments; however, after doing some more in depth reading into DirectInput, I've seen many people saying how DirectInput is NOT recommended for use

Calculating Rigid body Inertia Tensor world coordinates

混江龙づ霸主 提交于 2019-12-11 03:46:50
问题 I'm trying to implement a small rigid body physics simulation, using DirectX to draw my objects and its Math library to take advantage of SIMD calculation (XMMATRIX and XMVECTOR classes). My question is about the Inertia Tensor , I know that using its inverse I can calculate the angular acceleration like so: AngAcc = Inverse(I) * torque and that inertia tensor, in local space, is constant... so I have store its inverse in my RigidBody class with some other members: //'W' suffix means 'world

How to use a huge array in HLSL (error X4505)

瘦欲@ 提交于 2019-12-11 03:27:10
问题 When I try to compile I get the error: X4505: sum of temp register and indexable temp registers exceeds limit of 4096. However my shader does work in FX Composer . The reason it crashes is probably because I use a very large array since I'm using marching cubes. const static int edgeTable[256] = ... const static int triTable[256][16] = ... How should I go about using these arrays? (D11) 回答1: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476898(v=vs.85).aspx#Shader_Constant_Buffer

Simple radial gradient background in Metro-Style App

≡放荡痞女 提交于 2019-12-11 03:16:17
问题 What would be a simple way of drawing a radial gradient background (also being able to change it's color) in a XAML/C# Metro-Style App ? Is using DirectX an option ? I tried looking at some SharpDX samples for Windows 8 Consumer Preview but failed to compile them. Haven't found any other samples of using DX in C# on Windows 8. Any ideas ? 回答1: RadialGradientBrush has not been added to the XAML stack yet. You can use WriteableBitmapEx to draw the gradient to a WriteableBitmap yourself and then

DirectX game with no prerequisite software to run

青春壹個敷衍的年華 提交于 2019-12-11 02:31:48
问题 I'm new to programming with DirectX and I want to know how should I create a DirectX game. Will there be a way to package all the required files for people to run without the need for additional software? I'll add the exception that they'll need to install DirectX. What I mean is, when I try to run an executable version of a DirectX program on a computer that isn't setup to create DirectX projects, I get an error like "d3dx10_43.dll is missing" and I have directX version 11 installed on that

RAII for resources that can be invalidated

痞子三分冷 提交于 2019-12-11 02:28:01
问题 I'm a hobbyist C++ and DirectX programmer, so most of the knowledge I have is from old game development books in which the code designs are just to get something up and running as a demonstration, leaving me with a lot of design considerations for even the simplest of programs. During development of such a program, I recently learned of RAII , so I decided to give this design pattern a shot because from what I understood, an object should be usable and valid upon construction and this greatly

CallbackOnCollectedDelegate at Application.Run(new Form1())

佐手、 提交于 2019-12-11 02:20:48
问题 I made a very small application that captures the screen inside games using SlimDX. (I press left click to capture) The capture works (atleast when I click on the form itself) but as soon as I click on firefox or any other application, I get this exception : A callback was made on a garbage collected delegate of type 'CaptureScreen!CaptureScreen.Form1+WinEventDelegate::Invoke'. This may cause application crashes, corruption and data loss. When passing delegates to unmanaged code, they must be

Direct3D multiple vertex buffers, non interleaved elements

吃可爱长大的小学妹 提交于 2019-12-11 01:29:44
问题 I'm trying to create 2 vertex buffers, one that only stores positions and another that only stores colors. This is just an exercise from Frank Luna's book to become familiar with vertex description, layouts and buffer options. The problem is that I feel like I have made all the relevant changes and although I am getting the geometry to show, the color buffer is not working. To complete the exercise, instead of using the book's Vertex vertices[]={{...},{...},...} from the example code where