directx-11

SaveDDSTextureToFile() saves a black texture instead the expected

无人久伴 提交于 2019-12-24 11:55:18
问题 I have created a red colored texture of DXGI format DXGI_FORMAT_R32_FLOAT. I have a byte buffer of red color pixels where 4 byte per pixel is prepared. The byte buffer is then copied using device context map and unmap functions and after that I have created a shader resource view. I have get the resource back from resource view then passed that to SaveDDSTextureToFile() to save the bitmap data to dds file format. But when I am going to save it in dds in file to check it's saves a same sized

AcquireNextFrame not working (Desktop Duplication API & D3D11)

大兔子大兔子 提交于 2019-12-24 02:15:10
问题 I've put together this code that takes a screenshot of the desktop and maps it for raw pixel data access, but the output is all zeros. I have no idea what i've done wrong. After looking at many examples of the Desktop Duplication Api online I don't see any differences between them and mine. This is my method to initialize everything, and no errors are raised. BOOL init() { CHECKHR(D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, 0, gFeatureLevels, gNumFeatureLevels, D3D11_SDK

Render h264 video frames in directx 11

允我心安 提交于 2019-12-23 20:02:55
问题 I am new to DirectX . I am trying to write a custom IP camera video player and for which I am using DirectX11 to render the decoded image with Wpf Gui as my front end. I am a c# developer and have used managed directx which is no longer updated by microsoft hence moved to wpf and directx11. All parts of my application up to the rendering of the frames is working fine. I have managed to create a D3DImage source which will be used in Wpf app, successfully create my viewports and my device

Rendering in DirectX 11

喜你入骨 提交于 2019-12-23 17:28:55
问题 When frame starts, I do my logical update and render after that. In my render code I do usual stuff. I set few states, buffors, textures, and end by calling Draw. m_deviceContext->Draw( nbVertices, 0); At frame end I call present to show rendered frame. // Present the back buffer to the screen since rendering is complete. if(m_vsync_enabled) { // Lock to screen refresh rate. m_swapChain->Present(1, 0); } else { // Present as fast as possible. m_swapChain->Present(0, 0); } Usual stuff. Now,

Implement API to wait for d3d10 commands to finish

China☆狼群 提交于 2019-12-23 12:35:24
问题 I am implementing some functionality which requires me to implement an API to wait for d3d10 to finish rendering.Basically i am trying to implement synchronize access to a shared texture such that i can update a texture after d3d10 is successfully able to present to backbuffer. By calling this black box api i think this can be achieved and i think it will be something similar like glfinish().I have read we can use ID3D10Query queries for implementing synchronize access. D3D10_QUERY_DESC

c++ Directx11 capture screen and save to file

女生的网名这么多〃 提交于 2019-12-23 12:20:03
问题 i've got problem with saving texture2d to file, it always gives me black image. Here is code: HRESULT hr = SwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), reinterpret_cast< void** >( &g_pSurface ) ); if( g_pSurface ) { ID3D11Texture2D* pNewTexture = NULL; D3D11_TEXTURE2D_DESC description; g_pSurface->GetDesc( &description ); description.BindFlags = 0; description.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE; description.Usage = D3D11_USAGE_STAGING; HRESULT hr =

FreeType generates multiple textures

守給你的承諾、 提交于 2019-12-23 06:14:18
问题 I'm trying to use FreeType under DirectX 11, in order to draw some text on my screen. For the moment i'm able to convert a FT_Bitmap* to a ID3D11Texture2D* , then I create a ID3D11ShaderResourceView* . I then use a shader to draw this shader resource view. The problem is that this code only draws the last letter of the text 4 times , and I don't really see why. First, here is how I render a UI Element : Graph.cpp : void Graph::DrawSprite(Object* p_object) { /*...*/ // Problem here Text* text

DirectX 11 backward compatibility

耗尽温柔 提交于 2019-12-23 04:28:53
问题 I am learning DirectX by following code examples from here. I am at Code Set 1, chapter 6 Box code example. When I try to compile code of chapter 6 in DirectX 11 compatible machine, it runs fine but when I run that code in FEATURE LEVEL of directX 10 in DirectX 11 machine with shader 5.0 //d3App.cpp. //In InitDirect3D() method D3D_FEATURE_LEVEL a[]={D3D_FEATURE_LEVEL_10_0}; HRESULT hr = D3D11CreateDevice( 0, // default adapter md3dDriverType, 0, // no software device createDeviceFlags, a, 1,

Can't figure out Shaders for DirectX11?

ぐ巨炮叔叔 提交于 2019-12-23 03:15:55
问题 So, I have no idea how to use shaders. Coding them is easy, but not actually using them . MSDN is really useless to me, meaning they have the worst tutorials out there. I am currently reading Frank Luna's Direct3d 11 book, and I am finally to the part where I actually get to draw stuff. Exciting, except for the fact that it doesn't work. His BoxDemo - I'm sure worked 3 years ago when the book was made, but now with all of the new DirectX stuff - omitting the DirectX SDK and now using "Windows

How to determine the system DirectX is 11 or 11.1?

和自甴很熟 提交于 2019-12-22 10:04:06
问题 I am running Windows 7. When I use DxDiag, it shows the version as 11. When I use Visual Studio 2012 which can access Windows API, it can run the code with feature level D3D_FEATURE_LEVEL_11_1 So I agot confused, what is the exact version of my DirectX version? 回答1: There are a number of confounding factors at work here, so let's take them one at a time: DXDIAG is part of the OS along with the DirectX Runtime but is also manually updated for that string, so it is often less than detailed