directx

Understanding Shader Programming

三世轮回 提交于 2019-12-08 02:50:08
问题 I am trying to understand shader programming, but at this point, documentation wont help me further. 1] Does the data type & size of the buffers have to match? In the DX tutorial 4 from the DX SDK, they have a struct: struct SimpleVertex{ XMFLOAT3 Pos; XMFLOAT4 Color; }; While in their shader file, they define: struct VS_OUTPUT{ float4 Pos : SV_POSITION; float4 Color : COLOR0; }; They define Pos as a vector of 3 in one file, while it is 4 in another. How is this correct? I thought the size of

DirectX Release build works through VS2010, but not exe

随声附和 提交于 2019-12-08 02:32:27
问题 I've been dropping by Stack Overflow for a few years now via Google, but haven't asked/answered anything as of yet, so here goes. Basically I have a 3D rendering framework set up drawing models and terrain in DirectX 11. Everything works fine, with no problems when running either Debug or Release builds through Visual Studio 2010. However, when I navigate into my folders and run the executables independantly, only the Debug build works. The Release build displays whatever clear colour I have

DirectX::XMMATRIX error C2719: __declspec(align('16')) won't be aligned

我与影子孤独终老i 提交于 2019-12-08 02:04:01
问题 Ok so im working on my own DirectX framework all tutorials about making a DirectX framework are old and use deprecated stuff so i just made my own one , though i took somethings from the old tutorials and updated them to work with the new Windows 8.1 SDK and here comes The problem , i get errors with XMMATRIX the original code uses D3DXMATRIX (33): error C2719: 'unnamed-parameter': formal parameter with __declspec(align('16')) won't be aligned (40): error C2719: 'unnamed-parameter': formal

DirectX11 CreateWICTextureFromMemory Using PNG

家住魔仙堡 提交于 2019-12-08 01:52:42
问题 I've currently got textures loading using CreateWICTextureFromFile however I'd like a little more control over it, and I'd like to store images in their byte form in a resource loader. Below is just two sets of test code that return two separate results and I'm looking for any insight into a possible solution. ID3D11ShaderResourceView* srv; std::basic_ifstream<unsigned char> file("image.png", std::ios::binary); file.seekg(0,std::ios::end); int length = file.tellg(); file.seekg(0,std::ios::beg

Strange behavior with rotation matrices

余生颓废 提交于 2019-12-08 01:38:34
问题 I am trying to render a spaceship directly in front of a camera, with the model rotating with the camera's view. This works, as long as the player only yaws or rolls. If he does both, it goes into a tumble. A video of the problem is here: http://youtu.be/voKTsdy5TFY The relevant code follows, edited for clarity: D3DXMatrixRotationAxis(&playeryaw, &up, yawangle); D3DXMatrixRotationAxis(&playerpitch, &right, pitchangle); playerrot = playeryaw * playerpitch; D3DXMatrixTranslation(&playertrans,

3D Spaces (Model/World, View/Eye, Projection)

∥☆過路亽.° 提交于 2019-12-08 01:22:48
问题 This isn't a question but I was very confused about what 3D space corresponded to what. I was used to hearing Model, View, Projection space but at my job they use World, Eye, Projection. I didn't realize that World and Eye were synonyms for model and view so if anyone has any confusion on this i found the following clarification to help (hopefully it will help you). Local Space : These are the coordinates that make up the 3D model in a rendering program like 3Ds Max or any other. It defines

syntax error: identifier 'DXGI_RGBA in file dxgi1_2.h

浪子不回头ぞ 提交于 2019-12-08 01:20:05
问题 Trying to integrate the Directx toolkit into my game. I followed the steps here: https://github.com/Microsoft/DirectXTK/wiki/Adding-the-DirectX-Tool-Kit and everything went great. When trying to include one of the headers (SpriteFont.h) I get these errors: I've refactored the project to 8.1 to match my game, and rebuilt the imported project and it works great. It's when rebuilding my project that I get these error. (I've already made sure windows.h is being included before my directx headers.

sphere texture mapping error

人盡茶涼 提交于 2019-12-07 23:58:29
问题 i use D3DXCreateSphere method to create sphere mesh. and i want to apply an earth texture on it. i calculate the texture coordinate in pixel shader with following code: sampler ShadeSampler = sampler_state { Texture = (ShadeTex); AddressU = Mirror; AddressV = Mirror; MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = LINEAR; }; PS_OUTPUT PSMain(VS_OUTPUT input){ PS_OUTPUT output = (PS_OUTPUT)0; vector uv; uv.x = 0.5 + atan2(input.normal.z, input.normal.x) / piMul2; uv.y = 0.5f - asin(input

Using mem_fun_ref with boost::shared_ptr

醉酒当歌 提交于 2019-12-07 20:56:10
问题 Following the advice of this page, I'm trying to get shared_ptr to call IUnknown::Release() instead of delete: IDirectDrawSurface* dds; ... //Allocate dds return shared_ptr<IDirectDrawSurface>(dds, mem_fun_ref(&IUnknown::Release)); error C2784: 'std::const_mem_fun1_ref_t<_Result,_Ty,_Arg> std::mem_fun_ref(_Result (__thiscall _Ty::* )(_Arg) const)' : could not deduce template argument for '_Result (__thiscall _Ty::* )(_Arg) const' from 'ULONG (__cdecl IUnknown::* )(void)' error C2784: 'std:

Create Swap Chain Failed

点点圈 提交于 2019-12-07 20:18:53
问题 I am following a DX sample & MSDN reference, but I hit a wall now. I get the HRESULT of E_InvalidArg from D3D11CreateDeviceAndSwapChain(). I know it is the IDXGIAdapter I passed, since it works if I change it to null. I cannot figure out what is wrong with my initialization. Maybe someone with better knowledge knows what I did wrong. Here it is: The vars: vector<IDXGIAdapter1*> vAdapters; IDXGIAdapter1* selectedVAdapter; // Constructor inits this to null Methods: void refreshVideoAdapters(){