direct3d

How to set a click event for a Sphere (Mesh)?

断了今生、忘了曾经 提交于 2020-01-05 06:09:09
问题 In the picture above you can see a part of my application. I load a file with different values and afterwards I parse them. Then I draw a 3D coordinate system to show the Lab color space. To draw each sphere I use the Mesh - function: /// <summary> /// Vertex für die Kugel /// </summary> struct Vertex { public float x, y, z; // Position of vertex in 3D space public int color; // Diffuse color of vertex /// <summary> /// Konstruktor der Vertex /// </summary> /// <param name="_x">X(A) -

Alpha测试

这一生的挚爱 提交于 2020-01-04 04:42:22
Alpha测试可控制Direct3D程序是否绘制当前像素(根据是否满足Alpha测试条件),图形程序应用Alpha测试可以有效地屏蔽某些像素颜色。与Alpha混合相比,Alpha测试不能将绘制像素颜色与颜色缓冲区像素混合,像素要么完全不透明,要么完全透明。由于无须进行颜色缓冲区的读操作,因此Alpha测试在速度上要优于Alpha混合。   Alpha测试通过渲染状态D3DRS_ALPHATSTEABLE设置,下列代码激活Direct3D的Alpha测试状态:   // g_pd3dDevice为有效的Direct3D设备   g_pd3dDevice->SetRenderState( D3DRS_ALPHATESTENABLE, TRUE );   渲染状态D3DRS_ALPHAREF用来设置进行Alpha测试的参考值AlphaReference。Alpha测试函数比较当前绘制的像素的Alpha值和AlphaReference值,如果返回TRUE,则通过测试并绘制像素,反之不予绘制。 AlphaReference的取值范围从0×00000000~0×000000ff。下列代码设置Alpha测试的参考值为0×00000001:   // g_pd3dDevice为有效的Direct3D设备   g_pd3dDevice->SetRenderState( D3DRS_ALPHAREF,

Can D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT be passed with D3D_FEATURE_LEVEL_11_0?

試著忘記壹切 提交于 2020-01-02 09:56:24
问题 MSDN on D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT says: Direct3D 11: This value is not supported until Direct3D 11.1. Does this mean runtime version or feature level? Can I pass the flag to D3D11CreateDevice but only pass feature level 11_0? Is the feature level irrelevant and it just depends on the installed runtime version? What happens if I pass the flag to a DX runtime 11.0? Will it just be ignored silently? Or do I first have to detect the DX runtime version somehow, and then pass the flag

Can D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT be passed with D3D_FEATURE_LEVEL_11_0?

爷,独闯天下 提交于 2020-01-02 09:56:24
问题 MSDN on D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT says: Direct3D 11: This value is not supported until Direct3D 11.1. Does this mean runtime version or feature level? Can I pass the flag to D3D11CreateDevice but only pass feature level 11_0? Is the feature level irrelevant and it just depends on the installed runtime version? What happens if I pass the flag to a DX runtime 11.0? Will it just be ignored silently? Or do I first have to detect the DX runtime version somehow, and then pass the flag

c++ d3d hooking - COM vtable

江枫思渺然 提交于 2020-01-02 08:48:09
问题 Trying to make a Fraps type program. See comment for where it fails. #include "precompiled.h" typedef IDirect3D9* (STDMETHODCALLTYPE* Direct3DCreate9_t)(UINT SDKVersion); Direct3DCreate9_t RealDirect3DCreate9 = NULL; typedef HRESULT (STDMETHODCALLTYPE* CreateDevice_t)(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DDevice9** ppReturnedDeviceInterface); CreateDevice_t RealD3D9CreateDevice = NULL; HRESULT

D3D11 screen desktop copy to ID3D11Texture2D

烈酒焚心 提交于 2020-01-01 07:09:13
问题 I am writing a DLL plugin that will read the desktop frame buffer (whole screen) and render it directly into a Texture2D pointer that is passed in. The goal is to keep everything in video memory (and avoid the cost of copying back to system memory and back to video memory). I am able to pass the Texture2D (showing up as a ID3D11Texture2D), but I am having issues grabbing the desktop frame buffer with D3D11. D3D9 offered GetFrontBufferData() but it seems D3D11 solution is to use GetBuffer().

Performance of different CG/GLSL/HLSL functions

不羁岁月 提交于 2019-12-30 17:58:13
问题 There are standard libraries of shader functions, such as for Cg. But are there resources which tell you how long each takes... I'm thinking similar to how you used to be able to look up how many cycles each ASM op would take. 回答1: There are no reliable resources that will tell you how long various standard shader functions take. Not even for a particular piece of hardware. The reason for this has to do with instruction scheduling and the way modern shader architectures work. Take a simple

Requirements for target application for Visual Studio 11's Graphics Debugger

大城市里の小女人 提交于 2019-12-30 02:20:26
问题 I was super happy when the "Graphics Debugger" feature was announced for Visual Studio 11, I immediately attempted to get it working on various projects I had, unfortunately I've only managed to get it working for Windows 8 Metro applications! Specifically the C++ Metro project templates run and capture all expected information correctly. With Developer Preview versions of Visual Studio, and on Windows 7, any attempt to launch applications under the Graphics Debugger (Alt-F5) crash on

Windows Phone: Log to console

丶灬走出姿态 提交于 2019-12-29 07:32:09
问题 Disclaimer: I'm quite new to the MSFT tech world and only started Windows Phone development a month or so ago. I am unable to figure out how to log information to the Visual Studio Output window from within a C# and C++ (Direct3D) Windows Phone 8 App. Is this possible? I am building in debug mode, targeting Windows Phone 8, running in the XDE emulator and my development machine is a Windows 8 box with VS2012 Ultimate installed. My App runs fine, my Direct3D scene renders normally, but I can't

Loading FBX model into DirectX application

僤鯓⒐⒋嵵緔 提交于 2019-12-25 01:56:23
问题 I am trying to render a 3d model from FBX file in my directx application, so I have loaded it using fbx sdk, but I found a big problem, probably caused by different coordinate system: DirectX use left handed, Fbx - right handed, so finally I got it rendered, but with two issues: all parts of the model look mirrored by Z axis (or by X - its not clear) position of the parts is incorrect after applying transformation matrix provided by FBX for each part; So how what I can do with Vertex data and