direct3d

IDXGISwapChain::Present Memory Leak

谁都会走 提交于 2019-12-11 09:29:14
问题 I'm kinda learning Direct3D and have this quite basic code, nothing too fancy. During debugging in Visual Studio I noticed a constantly increasing memory usage, which is kinda weird. From what I observed, IDXGISwapChain::Present allocates new memory blocks with each frame update. Here is a difference between two memory snapshots, about 7 second difference. I have no idea what could be the cause of this, maybe I forgot to call some sort of clearing function? And I don't even have any buffers

Rendering formatted text in a direct3d application

自作多情 提交于 2019-12-11 07:28:07
问题 I need to render some formatted text (colours, different font sizes, underlines, bold, etc) however I'm not sure how to go about doing it. D3DXFont only allows text of a single font/size/weight/colour/etc to be rendered at once, and I cant see a practical way to "combine" multiple calls to ID3DXFont::DrawText to do such things... I looked around and there doesn't seem to be any existing libraries that do these things, but I have no idea how to implement such a text renderer, and I couldn't

How to take CPU memory(UCHAR Buffer) in to GPU memory(ID3D11Texture2D Resource)

心已入冬 提交于 2019-12-11 07:09:22
问题 The code here will run in GPU and capture windows screen, it give us ID3D11Texture2D Resource. Using ID3D11DeviceContext::Map I taking GPU resource in to BYTE buffer from BYTE buffer in to CPU Memory g_iMageBuffer its a UCHAR . Now I want to do reverse engineering, I want to take g_iMageBuffer buffer(CPU Memory) in to ID3D11Texture2D (GPU memory). Please someone help me how to do this reverse engineering I am new to graphical part. //Variable Declaration IDXGIOutputDuplication* IDeskDupl;

Direct3D multiple vertex buffers, non interleaved elements

吃可爱长大的小学妹 提交于 2019-12-11 01:29:44
问题 I'm trying to create 2 vertex buffers, one that only stores positions and another that only stores colors. This is just an exercise from Frank Luna's book to become familiar with vertex description, layouts and buffer options. The problem is that I feel like I have made all the relevant changes and although I am getting the geometry to show, the color buffer is not working. To complete the exercise, instead of using the book's Vertex vertices[]={{...},{...},...} from the example code where

Embed button control into existing Direct3D application

天大地大妈咪最大 提交于 2019-12-10 22:04:25
问题 I would like to overlay own content above a Direct3D v9 game (made by a third party). Overlay Interactive Button Specifically, I would like to overlay a clickable button control, like Steam does, for instance, though I'm attempting a much simpler interface. Ideally, I would be able to overlay a WPF button or a Windows Form button or whole UserControl, but if that is not possible then creating a functioning button from primitives would suffice as well. Text Overlay Working with SharpDX I have

Strange smeared edges pattern using HLSL for YUV to RGB conversion

拥有回忆 提交于 2019-12-10 20:39:54
问题 I'm trying to write a YUV to RGB shader in HLSL. Specifically, it converts the Yuv420p format which consists of an N M plane of Y values, followed by an (N/2) (M/2) plane of U values and then an (N/2)*(M/2) plane of V values. For example this 1280x720 picture: looks like this in YUV format interpreted as an 8-bit, 1280x1080 texture: In Direct3D11, I'm loading this as a Texture2D with format R8_UNorm and dimensions 1280x1080. The tricky part is reconstituting the U and V planes, because as you

Why won't Direct3D recover after unplugging a monitor in Windows XP?

那年仲夏 提交于 2019-12-10 16:51:28
问题 An interesting bug came up that I'm having no luck with. In a windowed Direct3D9 program using native code, I handle a device lost using something similar to the following: void MyClass::RecoverFromDeviceLost(LPDIRECT3DDEVICE9 deviceToRecover, D3DPRESENT_PARAMETERS devicePresentParams ) { HRESULT hr = deviceToRecover->TestCooperativeLevel(); if(hr == D3DERR_DEVICELOST ) { //Code to shutdown all D3DPOOL_DEFAULT allocated objects }else if(hr == D3DERR_DEVICENOTRESET){ hr = deviceToRecover-

C++ Direct3D Multiple Screen Capture

隐身守侯 提交于 2019-12-10 14:48:20
问题 Hello Direct3D experts, I am currently developing an application with Direct3D in order to capture my two monitors desktop (used as extended desktop of course). The following code works well but I am just able to capture the primary display and not the extended desktop (just one screen is captured twice) How can I adapt this solution for a dual screen capture ? First of all, I initialize Direct3D: D3DDISPLAYMODE d3dDisplayMode; D3DPRESENT_PARAMETERS d3dPresentationParameters; //Presentation

Passing colors through a pixel shader in HLSL

ぃ、小莉子 提交于 2019-12-10 14:35:37
问题 I have have a pixel shader that should simply pass the input color through, but instead I am getting a constant result. I think my syntax might be the problem. Here is the shader: struct PixelShaderInput { float3 color : COLOR; }; struct PixelShaderOutput { float4 color : SV_TARGET0; }; PixelShaderOutput main(PixelShaderInput input) { PixelShaderOutput output; output.color.rgba = float4(input.color, 1.0f); // input.color is 0.5, 0.5, 0.5; output is black // output.color.rgba = float4(0.5f, 0

How can I draw a transparent 3D object with the SharpDX Toolkit?

雨燕双飞 提交于 2019-12-10 13:31:33
问题 I'm working on an application that uses SharpDX and the SharpDX Toolkit to draw simple 3D shapes, and the Geometrics.Desktop sample was very helpful in getting started. Now I'm trying to make some shapes transparent, and to keep things simple I'm just trying to make the teapot model in in that sample appear transparent (perhaps translucent would be more precise). For those not familiar with the Geometrics.Desktop sample, it draws a few simple primitive geometric shapes in 3D. Being a sample