direct3d

XMVector3Dot performance

荒凉一梦 提交于 2019-12-12 05:36:08
问题 When running a performance profiler (VS2017), I find that XMVector3Dot shows up as taking some time (it's part of my code that does collision detection). I find that by replacing the usage of XMVECTOR with XMFLOAT3 and manually calculating a dot product (the same reasoning applies to other vector operations), that the speed of my algorithm is faster. I understand that XMVECTOR s are of course needed when suppling the GPU with vectors etc, this is what the GPU understands, but is it expected

Direct3D Rotation Matrix from Vector and vice-versa

試著忘記壹切 提交于 2019-12-12 05:28:45
问题 I need to compute a rotation matrix from a direction vector, and a direction vector from a rotation matrix. The up direction should correspond to the z-axis, forward is y and right is x; D3DXMATRIX m; // the rotation matrix D3DXVECTOR3 v; // this is the direction vector wich is given D3DXVECTOR3 r; // resulting direction vector float len = D3DXVec3Length(&v); // length of the initial direction vector // compute matrix D3DXMatrixLookAtLH(&m, &v, &D3DXVECTOR3(0,0,0), &D3DXVECTOR3(0,0,1)); //

No thumbnails showing in Aero flip/thumbnail for full screen direct3d 9 application

可紊 提交于 2019-12-12 05:18:51
问题 I'm sure this is on the web somewhere, but I'm having trouble with the search terms (getting lots of non-relevant stuff.) Anyway, I've got a Direct3D9 application. When it runs in full screen, on Vista and Windows 7, and you hit Alt-Tab or Win-Tab, my application just shows up blank in the thumbnail/preview/live view (not sure of the correct term.) Is there an API or notification I can respond to where I can draw my backbuffer to the thumbnail? 回答1: When running a full-screen Direct3D

Translate - Rotate - Translate Back using XMMATRIX

三世轮回 提交于 2019-12-12 02:14:03
问题 If all I know is an object's World matrix (because its x/y/z position is not tracked, which would be easier), how do I go about rotating it around it's center? If I knew the location, it'd be about as simple as something like this: XMMATRIX world = pMissile->GetWorldMatrix(); XMMATRIX matrixTranslation = XMMatrixTranslationFromVector(pMissile->GetPosition()); XMMATRIX matrixInvTranslations = XMMatrixInverse(nullptr, matrixTranslation); float rotationAmount = (60 * XMConvertToRadians((float

Vertex Shader Creating

别等时光非礼了梦想. 提交于 2019-12-12 01:37:07
问题 I am learning D3D and currently i am at shaders. I wrote the code and built it - succeed but when debug i get this error: ERROR Here is the line where debugger breake: dev->CreateVertexShader(VS->GetBufferPointer(), VS->GetBufferSize(), NULL, &pVS); And here is the whole function: void InitPipeline() { // load and compile the two shaders ID3D10Blob *VS, *PS; D3DX11CompileFromFile("Shaders.shader", 0, 0, "VShader", "vs_4_0", 0, 0, 0, &VS, 0, 0); D3DX11CompileFromFile("Shaders.shader", 0, 0,

How to scroll window contents using Direct2D api?

 ̄綄美尐妖づ 提交于 2019-12-12 00:36:38
问题 I would like to scroll window contents in which drawing is performed with Direct2D api through ID2D1RenderTarget. In GDI I could create a buffer with CreateCompatibleDC and later scroll its contents with ScrollDC, redraw exposed area and BitBlt the buffer to window. I cannot see any necessary API in Direct2D to perform the same operations. How can I achieve the same functionality without using GetDC (and GDI), and without using own third buffer? 回答1: There is no Scroll API in Direct2D. Your

VS2015与DirectX11的配置之美

瘦欲@ 提交于 2019-12-11 23:48:13
什么是DirectX11? DirectX,微软提供的应用程序接口集(APIs),被设计为在运行 windows 操作系统平台上用来提供给开发人员控制硬件的底层接口。它的各个组件提供了访问不同硬件的能力,包括图形(显卡),声音(声卡),GPU,输入设备以及所有的标准接口(译者注:比如游戏操纵杆,鼠标等)。 DirectX 是首先被游戏制作者用来在 Windows 和 Xbox 平台上使用的标准 API 集。它是在设备上提供驱动层来操作硬件的。(注意:Xbox369 使用 DirectX9 之后的版本开发) DirectX11与之前版本的比较 Direct3D 10 的 API 相比于前一个版本是显得轻量的,并且其 API 比过去的版本都更加的容易使用。 与其他版本一个显而易见的不同就是在 Direct3D 10 中移除了固定的函数管线,而被移除的部分却是渲染状态和在 API 中构建算法来允许使用公共特效渲染对象的一个必须的集合。在图形硬件上面移除固定函数管线取而代之的是可编程着色器。 在 Direct3D 9 中,我们能够通过着色器来渲染几何体,开启光照只需要设置少量的性质和渲染状态,那些 API会转化我们的几何体使得发布时只需要调用少量的 Direct3D 函数。在 Direct3D 10 中我们依旧能够通过着色器做上述所有的事情,而且还能做得更多

is screenshotting by DirectDraw faster than GDI way?

让人想犯罪 __ 提交于 2019-12-11 15:48:26
问题 just to save some time, probably anybody tried this or saw somewhere related info. asking about DirectDraw and not about DirectX because I need to support Win2000 and up, and I cannot install DirectX on target PC 回答1: tried capturing by Direct3D and compared with GDI way. Results are not unambiguous. On my Win7 x64 with rather good video card D3D way shows ~2 times performance boost. On my WinXP 32bits laptop with not-integrated but old video card D3D works much much much longer. On another

ID3DXSprite depth sorting

时光怂恿深爱的人放手 提交于 2019-12-11 13:57:01
问题 I have two sprites A and B. A - opaque, Z = 1. B - half-transparent, Z = 0. Draw call order A -> B. According to MSDN I should use flag D3DXSPRITE_SORT_DEPTH_BACKTOFRONT when drawing transparent sprites of varying depths. Problem is it works vice versa - only with flag D3DXSPRITE_SORT_DEPTH_FRONTTOBACK . Please explain how depth sorting works in ID3DXSprite and where is Z value growing (I assume from 0 to 1, 1 being most remote from screen). 回答1: If you use D3DXSPRITE_SORT_DEPTH_FRONTTOBACK ,

C++ Direct3D9 GetFrontBufferData with 16 bits color Depth

隐身守侯 提交于 2019-12-11 12:48:07
问题 I am currently developing a little screenshot application which records both of my screen's desktop in a file. I am using the GetFrontBufferData() function and it is working great. Unfortunately when changing the screen color depth from 32 to 16 bits (to perform some tests) I have a bad image (purple image with changed resolution) and the recorded screenshot has a very poor quality: Does someone know if there is a way to use GetFrontBufferData() with a 16 bits screen ? edit: My init direct3D: