directx

How do I calculate pixel shader depth to render a circle drawn on a point sprite as a sphere that will intersect with other objects?

让人想犯罪 __ 提交于 2019-12-29 21:06:27
问题 I am writing a shader to render spheres on point sprites, by drawing shaded circles, and need to write a depth component as well as colour in order that spheres near each other will intersect correctly. I am using code similar to that written by Johna Holwerda: void PS_ShowDepth(VS_OUTPUT input, out float4 color: COLOR0,out float depth : DEPTH) { float dist = length (input.uv - float2 (0.5f, 0.5f)); //get the distance form the center of the point-sprite float alpha = saturate(sign (0.5f -

Could not load file or assembly X or one of its dependencies. is not a valid Win32 application. (HRESULT: 0x800700C1)

浪子不回头ぞ 提交于 2019-12-29 08:16:29
问题 OS: Windows 8.1 64 I tried to play multiple sounds in VB.Net with DirectX, there are no errors in my code. The problem is whenever the event is fired I get this error System.BadImageFormatException was unhandled Message: An unhandled exception of type 'System.BadImageFormatException' occurred in System.Windows.Forms.dll Additional information: Could not load file or assembly 'Microsoft.DirectX.AudioVideoPlayback.dll' or one of its dependencies. is not a valid Win32 application. (Exception

DirectX SDK vs Windows SDK: which one to use?

拜拜、爱过 提交于 2019-12-29 03:39:09
问题 I have an old game engine (sort of) based on DirectX 10, which I've been planning to move to DX 11. I have also just installed Windows 8 and VS 2013 and, while trying to run this old project I've learnt that DirectX SDK has been deprecated and now replaced by Windows 8 SDK. In this case I wonder whether it makes sense to update to DX 11 or should I try and make my engine use the new Windows 8 SDK. There are several things I'd like to know before I make the decision: 1) Is Windows 8 SDK the

Doing readback from Direct3D textures and surfaces

六眼飞鱼酱① 提交于 2019-12-28 12:08:28
问题 I need to figure out how to get the data from D3D textures and surfaces back to system memory. What's the fastest way to do such things and how? Also if I only need one subrect, how can one read back only that portion without having to read back the entire thing to system memory? In short I'm looking for concise descriptions of how to copy the following to system memory : a texture a subset of a texture a surface a subset of a surface a D3DUSAGE_RENDERTARGET texture a subset of a D3DUSAGE

如何配置DirectX开发环境

偶尔善良 提交于 2019-12-25 23:32:03
一个DirectX程序要想正确的编译和链接,需要下面三个主要前提 安装DirectX SDK 正确配置.h文件路径和.lib文件路径 正确链接所需.lib文件 安装DirectX SDK 可以直接到微软的官方网站上下载最新的SDK,Microsoft DirectX SDK(June 2010)是微软发型的最后一个独立的DX SDK,以后则不再单独发行DX SDK,而是集成到Windows SDK当中。如果使用的是Visual Studio 2010及以前的版本,那么需要安装DX SDK,如果使用 Visual Studio 2012及后续版本,则自带Windows SDK(包含DirectX)。 配置.h文件和.lib文件路径 1. 启动VS,依次选择tools-option-projects and solutions-VC++Directories,在show directories for下面有几个选项 2. 选择Include files, 这个是DirectX头文件所在的地方,点击下面的新建文件夹按钮将DirectX头文件所在的路径输入进去。在我这里是 C:\Program Files\Microsoft DirectX SDK (March 2008)\Include 3. 选择Library fies,这是.lib文件所在的地方,如法炮制,将DirectX

Will `wglCreateContext` fail safely if a DirectX context already exists for the given `HDC` (device context)

对着背影说爱祢 提交于 2019-12-25 10:57:15
问题 I'm attempting to contribute to a cross-platform, memory-safe API for creating and using OpenGL contexts in Rust called glutin. There is an effort to redesign the API in a way that will allow users to create a GL context for a pre-existing window. One of the concerns raised was that this might not be memory safe if a user attempts to create a GL context for a window that has a pre-existing DirectX context. The documentation for wglCreateContext suggests that it will return NULL upon failure,

Will `wglCreateContext` fail safely if a DirectX context already exists for the given `HDC` (device context)

拥有回忆 提交于 2019-12-25 10:56:03
问题 I'm attempting to contribute to a cross-platform, memory-safe API for creating and using OpenGL contexts in Rust called glutin. There is an effort to redesign the API in a way that will allow users to create a GL context for a pre-existing window. One of the concerns raised was that this might not be memory safe if a user attempts to create a GL context for a window that has a pre-existing DirectX context. The documentation for wglCreateContext suggests that it will return NULL upon failure,

Direct3D9 - access depth/stencil buffer in pixel shader (and probably copy it to a different texture)

倾然丶 夕夏残阳落幕 提交于 2019-12-25 09:28:20
问题 EDIT: D24S8 textures cannot be copied. Period. Sometimes, however, it is possible to change the depth buffer format to INTZ, a special FOURCC format, which has the same layout, but can be set as input for texture samplers. Finally my approach was to use a proxy dll to intercept all texture creation calls to be able to change the format wherever D24S8 was given. Afterwards I could then bind this texture to a texture sampler of the pixel shader, set a R32F render target and write the sampled

How Can I Call GetAsyncKeyState() in UWP DirectX/XAML App?

蓝咒 提交于 2019-12-25 08:59:35
问题 I have some code I'm porting from a working WinJS/UWP app to a DirectX/XAML variant, but I can't get my hands on the keyboard state. Controller is not a problem, that works just fine via XInputGetState(). My problem is just the keyboard. Existing code is: Windows::UI::Core::CoreWindow^ win = Windows::UI::Core::CoreWindow::GetForCurrentThread(); if (win) { // misc. calls to win->GetAsyncKeyState() } XInputGetState(activeController, &inputState); But that fails because Windows::UI::Core:

DirectX9 CreateDevice failed with D3DERR_NOTAVAILABLE

僤鯓⒐⒋嵵緔 提交于 2019-12-25 06:59:44
问题 There is initializing code for dx9 device D3DDISPLAYMODE display; m_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &display); ZeroMemory(&m_d3dpp, sizeof(m_d3dpp)); m_d3dpp.Windowed = false; m_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; m_d3dpp.BackBufferFormat = display.Format; m_d3dpp.EnableAutoDepthStencil = false; m_d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE; /*BackBufferHeight and BackBufferWidth also set from elsewhere*/ DWORD flags = D3DCREATE_FPU_PRESERVE|D3DCREATE_MULTITHREADED; m