directx

Simulate mouse move in 3D games?

↘锁芯ラ 提交于 2019-12-05 06:15:53
问题 Hi I made a human computer interface to control mouse using fingers using C++ and OpenCV in CodeBlocks IDE http://www.youtube.com/watch?v=-q5aXTg0pVE I want to use this in a 3D game like medal of honor First I used SetCursorPos(x,y) it did not work so I switched to SendInput and mouse_event. They did work with a bug the character began pointing in all random directions and changing directions on its own. Should I use directinput as the game uses directx. If so how? I have tried many tutorials

DirectX 9 HLSL vs. DirectX 10 HLSL: syntax the same?

时光毁灭记忆、已成空白 提交于 2019-12-05 06:10:53
For the past month or so, I have been busting my behind trying to learn DirectX. So I've been mixing back back and forth between DirectX 9 and 10. One of the major changes I've seen in the two is how to process vectors in the graphics card. One of the drastic changes I notice is how you get the GPU to recognize your structs. In DirectX 9, you define the Flexible Vertex Formats. Your typical set up would be like this: #define CUSTOMFVF (D3DFVF_XYZRHW | D3DFVF_DIFFUSE) In DirectX 10, I believe the equivalent is the input vertex description: D3D10_INPUT_ELEMENT_DESC layout[] = { {"POSITION",0

How do I use a Direct3D 11 pointer wrapped in ComPtr to get a 11.1 interface?

≡放荡痞女 提交于 2019-12-05 04:25:35
I'm following tutorials and I've converted the usual initialisation to using ComPtrs up to this line: ID3D11Device* g_pd3dDevice = nullptr; ID3D11Device1* g_pd3dDevice1 = nullptr; // Obtain the Direct3D 11.1 versions if available hr = g_pd3dDevice->QueryInterface( __uuidof( ID3D11Device1 ), reinterpret_cast<void**>( &g_pd3dDevice1 ) ); Here's what I expected to be the straight analog: Microsoft::WRL::ComPtr<ID3D11Device> device = nullptr; Microsoft::WRL::ComPtr<ID3D11Device1> device1 = nullptr; // Obtain the Direct3D 11.1 versions if available hr = device->QueryInterface(__uuidof(ID3D11Device1

Animate 3D object on windows desktop

馋奶兔 提交于 2019-12-05 04:09:22
问题 I need to draw and animate a 3D object on windows desktop that the user can interact with (a dog for example). User interaction assumes clicks, display of (iregular shape) dialogs for user input etc. Do you know any concrete way to achieve this? I am thinking I have several options, any recomendations, which one is best, easiest? WPF OpenGL DirectX XNA Are there any libraries (free or paid) that can help? 回答1: I have done some reasearch and it seems like WPF is a good choice. It can import 3D

Is DirectSound the best audio abstraction layer for Windows?

陌路散爱 提交于 2019-12-05 02:41:23
问题 Is DirectSound the best audio abstraction layer for Windows? Switching my app from a very bad sound implementation, built to a specific chipset, to an abstration layer. App is native Winform, .net 3.5. DirectX/DirectSound is the likely choice, but a little concerned about the overhead. Any other options? Or is it silly to even THINK about anything else? 回答1: DirectSound is not getting the same love from Microsoft today as it got in the past. As far as DirectX is concerned, you may try XAudio2

How can I get a vector type in C#?

我是研究僧i 提交于 2019-12-05 01:32:41
I want to use Vectors in a C# application I'm writing, sepcifically a Vector3. What's the best way for me to get a Vector type without writing my own? I used one in a POC that I found on CodeProject . It's not ideal, but it worked for our situation. At the time, however, it did not have a method to reflect a Vector3 about a given normal, but that may have changed since then. If you don't mind using DirectX (some stay away from it for whatever reason), then there is a Vector3 type in that library as well. Well, there's a struct called Microsoft.DirectX.Vector3 if that's what you're looking for.

Using Multiple Vertex Buffers In DX10/DX11

醉酒当歌 提交于 2019-12-05 01:24:13
问题 I have a C++ DirectX 11 renderer that I have been writing. I have written a COLLADA 1.4.1 loader to import COLLADA data for use in supporting skeletal animations. I'm validating the loader at this point (and I've supported COLLADA before in another renderer I've written previously using different technology) and I'm running into a problem matching up COLLADA with DX10/11. I have 3 separate vertex buffers of data: A vertex buffer of Unique vertex positions. A vertex buffer of Unique normals. A

anyone can explain the “field of view”

天大地大妈咪最大 提交于 2019-12-05 00:55:28
In graphics software, sometimes we saw "field of view" for camera. Can someone explain what does it mean? The field of view (in the gluPerspective call) is the angle in degrees between a plane which passes through the camera position and the top of your screen and another plane which passes through the camera position and the bottom of your screen. Edit: Since you need not have a full-screen viewport: Any line which is projected to (x1, 0)-(x2, 0) lies in the first plane, any line that is projected to (x3, height)-(x4, height) lies in the second, where height is the height of your viewport in

How to normalize a mesh into -1 to 1, then revert from normalized mesh to original one?

元气小坏坏 提交于 2019-12-04 23:26:42
I have a mesh model in X, Y, Z format. Lets say. Points *P; In first step, I want to normalize this mesh into (-1, -1, -1) to (1, 1, 1). Here normalize means to fit this mesh into a box of (-1, -1, -1) to (1, 1, 1). then after that I do some processing to normalized mesh, finally i want to revert the dimensions to similar with the original mesh. step-1: P = Original Mesh dimensions; step-2: nP = Normalize(P); // from (-1, -1, -1) to (1, 1, 1) step-3: cnP = do something with (nP), number of vertices has increased or decreased. step-4: Original Mesh dimensions = Revert(cnP); // dimension should

How to keep pynput and ctypes from clashing?

荒凉一梦 提交于 2019-12-04 22:36:43
I'm using this gem from somewhere on this site. import ctypes import pynput SendInput = ctypes.windll.user32.SendInput W = 0x11 A = 0x1E S = 0x1F D = 0x20 # C struct redefinitions PUL = ctypes.POINTER(ctypes.c_ulong) class KeyBdInput(ctypes.Structure): _fields_ = [("wVk", ctypes.c_ushort), ("wScan", ctypes.c_ushort), ("dwFlags", ctypes.c_ulong), ("time", ctypes.c_ulong), ("dwExtraInfo", PUL)] class HardwareInput(ctypes.Structure): _fields_ = [("uMsg", ctypes.c_ulong), ("wParamL", ctypes.c_short), ("wParamH", ctypes.c_ushort)] class MouseInput(ctypes.Structure): _fields_ = [("dx", ctypes.c_long