direct3d

c++ Having multiple graphics options

我的未来我决定 提交于 2019-12-13 13:25:11
问题 Currently my app uses just Direct3D9 for graphics, however in the future I' m planning to extend this to D3D10 and possibly OpenGL. The question is how can I do this in a tidy way? At present there are various Render methods in my code void Render(boost::function<void()> &Call) { D3dDevice->BeginScene(); Call(); D3dDevice->EndScene(); D3dDevice->Present(0,0,0,0); } The function passed then depends on the exact state, eg MainMenu->Render, Loading->Render, etc. These will then oftern call the

laptop dual video cards - how to programatically detect and/or choose which one is used

折月煮酒 提交于 2019-12-13 06:40:08
问题 We're developing software which uses DirectX for 3D rendering on Windows 7 and later machines, 64-bit C#/.NET code. We've observed that a number of newer Dell laptops we're testing on have dual video cards. They have the Intel HD 4600 integrated graphics and they also have a faster NVIDIA Quadro card (for example). By default, out of the box, the Intel graphics are used by the DirectX application. This is done, presumably to preserve battery life. But the performance is noticeably worse than

Linker keeps showing errors after I changed from DirectX SDK to Windows SDK

懵懂的女人 提交于 2019-12-13 06:36:45
问题 I just removed all of the headers that were included in the DirectX SDK and i moved towards the Windows SDK, but once I did, the linker constantly complains about an "unresolved external symbol". The linker shows about 24 errors and most of these errors are about functions that I'm not even using in my game. Linker errors: error LNK2001: unresolved external symbol "union __m128 __vectorcall DirectX::XMVectorMultiply(union __m128,union __m128) error LNK2001: unresolved external symbol "union _

Mismatch between input assembler and vertex shader - but it looks right

余生颓废 提交于 2019-12-13 05:26:32
问题 I had a similar issue someone kindly solved here, but that led me to this one. The error is: "Input Assembler - Vertex Shader linkage error: Signatures between stages are incompatible. The input stage requires Semantic/Index (SV_POSITION,0) as input, but it is not provided by the output stage." Here is my declaration and the vertex shader input. Can anyone tell me why they wouldn't match? I'm stumped. static const D3D11_INPUT_ELEMENT_DESC vertexLayout[] = { { "SV_POSITION", 0, DXGI_FORMAT

Resizing and position a SharpDX sprite

两盒软妹~` 提交于 2019-12-13 05:19:40
问题 I'm trying to resize a DirectX Texture and place it in the top right corner of the window. I am drawing the texture using a sprite, here's is my code (I am using SharpDX): albumArtSprite.Begin(); NativeMethods.RECT rect; NativeMethods.GetClientRect(device.CreationParameters.HFocusWindow, out rect); float targetDimensions = 150f; var matrix = Matrix.Scaling(targetDimensions / albumArtInformation.Width, targetDimensions / albumArtInformation.Height, 0f) * Matrix.Translation(rect.Width -

Painting frames while media session is paused

六眼飞鱼酱① 提交于 2019-12-13 05:16:21
问题 I'm working on a custom video player using the Media Foundation framework. Currently, I can play, pause, stop or change the rate of the playback using an IMFMediaSession. I can also retrieve a single frame using an IMFSourceReader. I am currently able to render a frame (IMFSample) to a window area (a HWND) but only when the media session is stopped. My goal is to be able to render a frame while the media session is paused. (= doing frame-stepping using a source reader and not the media

How do I render a fullscreen frame with a different resolution than my display?

蓝咒 提交于 2019-12-13 04:22:12
问题 I am in the process of teaching myself DirectX development while going through all the tutorials on http://directxtutorial.com/. I have run into a problem that I believe is related to me having multiple monitors. My display is 1920 x 1080. When my code runs in its current state my primary monitor becomes black with the cursor in the middle. When I set my SCREEN defines at the top of my code to 1920 x 1080 my program runs fine and displays my sprite with the navy background. When I leave the

Directx 11 depth test not working

断了今生、忘了曾经 提交于 2019-12-13 03:22:02
问题 I cannot get my program to correctly choose which models to place in front. I have followed the MSDN code exactly. My code appears to correctly draw all polygons in a particular call of DrawIndexed, but each subsequent call seems to cause models to be drawn in the order they are drawn, not based on whether they are closer to the screen. Here is my code for initializing Direct3d: DXGI_SWAP_CHAIN_DESC sd; ZeroMemory( &sd, sizeof( sd ) ); sd.BufferCount = 1; sd.BufferDesc.Width = width; sd

When does XNA discard Render Target contents?

倖福魔咒の 提交于 2019-12-12 14:53:36
问题 I understand that Render Targets in XNA are volatile, but how volatile are they? I can't find any documentation that tells when exactly their contents are discarded. Is it just when you start drawing to them, or could it be at any time? I would like to simply draw to a render target once and then use it as a Texture2D indefinitely. Is this possible? Would I need to enable RenderTargetUsage.PreserveContents for this to work properly? I have read that PreserveContents is very slow on Xbox and

Calculating screen texture coordinates in CG/HLSL

纵然是瞬间 提交于 2019-12-12 09:13:24
问题 In OpenGL , sometimes when doing multi-pass rendering and post-processing I need to apply texels to the primitive's assembly fragments which are part of full screen texture composition.That is usually the case when the current pass comes from FBO texture to which the screen quad had been rendered during previous pass.To achieve this I calculate objects UV coordinates in SCREEN SPACE .In GLSL I calculate it like this: vec2 texelSize = 1.0 / vec2(textureSize(TEXTURE, 0)); vec2 screenTexCoords =