directx

Programmatically creating directx 11 textures, pros and cons of the three different methods

二次信任 提交于 2019-12-12 07:09:51
问题 The msdn documentation explains that in directx 11 there are multiple ways to fill a directx 11 texture programmatically: (1) Create the texture with default usage texture and initialize it with data from memory (2) Create the texture with dynamic usage, use DeviceContext Map to get a pointer to texture memory, write to it, then use Unmap to indicate you are done (at which point I guess it is copied to the gpu) (3) Create the texture with staging usage and follow same steps as for dynamic

Quaternion-Based-Camera unwanted roll

断了今生、忘了曾经 提交于 2019-12-12 06:47:09
问题 I'm trying to implement a quaternion-based camera, but when moving around the X and Y axis, the camera produces an unwanted roll on the Z axis. I want to be able to look around freely on all axis. I've read other topics about this problem (for example: http://www.flipcode.com/forums/thread/6525 ), but I'm not getting what is meant by "Fix this by continuously rebuilding the rotation matrix by rotating around the WORLD axis, i.e around <1,0,0>, <0,1,0>, <0,0,1>, not your local coordinates,

FireBreath FB::PluginWindowWin include problem

痴心易碎 提交于 2019-12-12 05:42:52
问题 I tried to follow the steps in the answer of Directx control in browser plugin but when I added the solution mentioned in http://colonelpanic.net/2010/11/firebreath-tips-drawing-on-windows/ FireBreath Tips: Drawing on Windows "1.Make your plugin object windows specific change the type of the event source specified in EVENTTYPE_CASE to FB::PluginWindowWin (as well as the type in the handlers) and you will have your object cast in the way you need it." I got 119 errors, all are in winsock2.h

Invisible geometry in DX11

为君一笑 提交于 2019-12-12 02:56:32
问题 After struggling for many hours to understand and compensate for Microsoft's deprecation of D3DX in Windows 8, I've run into a problem that I can't shake off. The first time I started my program, it became immortal because of an access violation. After having restarted my computer and recompiling and running the same code, it doesn't crash, but the cube I should be seeing just isn't there. I'm also getting a warning that "object declared on the heap may not be aligned 16". AFAIK from my

How to remove Blur halo effect

假如想象 提交于 2019-12-12 02:46:44
问题 I'm trying to blur my depth buffer and then get surface normal for my fluid simulation here is my hlsl pixels shader Bilateral Filter float depth = depthTexture.Sample( defss1, pin.Tex).x; float blurDepthFalloff = 2.0f; float radius = 4.0f; float blurScale = 2.0f / radius; float sum = 0.0f; float wsum = 0.0f; float2 scale = (1.0f/(1920.0f), 1.0f/(1080.0f)); for(float x=-radius; x<=radius; x+=1.0f) { float cur = depthTexture.Sample( defss1, pin.Tex + x * scale).x; // range domain float r2 =

directx11 - can't set Texture2D as ShaderResourceView?

六月ゝ 毕业季﹏ 提交于 2019-12-12 02:32:44
问题 I have written a little DirectX RenderEngine, to render and texture simple Polygons. The texturing worked with CreateDDSTextureFromFile(.dds) very well. Now, I try to set up a Texture and a corresponding ShaderResourceView from a Memory buffer. Creating the Texture2D works, but then, CreateShaderResourceView ALWAYS fails . Also tried to call it with 2nd param set to NULL, also fails. I was trying to figure out what's wrong here for the whole week. I hope somebody can help me here. [Code] :

IDirect3DDevice9::EndScene hook sometimes get NULL in the parameter IDirect3DDevice9

删除回忆录丶 提交于 2019-12-12 02:26:54
问题 I made a trampoline hook for the function IDirect3DDevice9::EndScene. The codecave I modified the start if the EndScene function to jump to is this: __declspec(naked) HRESULT EndScene_Hook(IDirect3DDevice9* device) { ScreenCapture::Capture(device); __asm { PUSH 0x14 MOV EAX, 0x718E6478 JMP address } } The problem is that sometimes device is NULL, why is that? if I add a small condition like this: if(device != NULL) ScreenCapture::Capture(device); Everything works as intended with no errors.

Directx 11 Compatiblilty

时光总嘲笑我的痴心妄想 提交于 2019-12-12 02:18:07
问题 My hardware only supports Directx 10.1 but I know through feature levels I can develop with the directx 11 API and still maintain compatibility. One concern that I have is my hardware supports shader model 4.1 and directx 11 supports shader model 5.0. So my question is will I be able to develop for directx 11 including the shader model 5.0 with my directx 10.1 hardware? All help is appreciated. 回答1: Short of using the reference device or WARP, the answer is no. While you will be using the

D3D10 Constant buffer not working

半腔热情 提交于 2019-12-12 01:45:36
问题 I am using a constant buffer to transfer data to my pixel shader The problem is that the buffer contains 0s in the shader during runtime for x, y, z, and w of the float4 member, regardless of what data is updated to the buffer Structure definitions are as follows: // (C++) struct Buffer { XMMATRIX mvp_; XMFLOAT4 rgba_; int usemvp_; }; // HLSL cbuffer Buffer : register( b0 ) { matrix mvp_; float4 rgba_; int usemvp_; }; Any help is much appreciated 回答1: You need to pad your struct to make it 16

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 )}