8/29/2023 0 Comments Directx 11 supportRtv.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D Hr = CreateD3D11Texture2D(_d3d_device, width, height, &_dc_texture2d) Hr = _swap_chain->GetBuffer(0, _uuidof(ID3D11Texture2D), (void**)&_back_texture2d) HRESULT hr = _swap_chain->ResizeBuffers(2, width, height, DXGI_FORMAT_B8G8R8A8_UNORM, _is_gdi_compatible ? DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE : 0) HRESULT CGraphRender::Resize(const UINT32& width, const UINT32& height)įloat dpi = GetDpiFromD2DFactory(_d2d_factory) So how to do it: Whether the D3D or DC methods is drawn, they are all on the same ID3D11Texture2D? This way, it is also convenient for my CopyResource. I suspect that the ID3D11Texture2D/IDXGISurface1 obtained by GetBuffer on Win7 will have some restrictions on the use of GDI, so I changed to dynamically create a new ID3D11Texture2D by myself, and now use DC alone/D3D11 drawing interface alone It works fine, but if I interoperate, I will find that gdi opertaion is drawn on the custom-created ID3D11Texture2D instead of the back_buffer of swapchain: _d3d->Clear() Via swapchain -> GetBuffer(IDXGISurface1) -> GetDC, same as 1.It runs normally on my Win10, but an exception report when running GetDC on Win7: _com_error. Through swapchain -> GetBuffer(ID3D11Texture2D) -> CreateDxgiSurfaceRenderTarget -> ID2D1GdiInteropRenderTarget -> GetDC, finally get the DC. I created a D3D11 device and can perform operations such as rendering pictures smoothly, but in order to also support GDI, I tried several methods:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |