Category : direct2d

i want create direct2D render target that will render on screen with direct3D, so i try to call the D2D1Factory::CreateDxgiSurfaceRenderTarget() funtion to make a direct2D render target, but it keep fails. The error i get from HRESULT is invalid argument-s passed. I tried these 3 codes FLOAT dpiX; FLOAT dpiY; factory->GetDesktopDpi(&dpiX, &dpiY); D2D1_RENDER_TARGET_PROPERTIES props = ..

Read more

I have a graphics engine using ID2D1Device1, but I cant seem to alter it to use ID2D1Device3. Does anyone know of an example anywhere? Here is my core code: Microsoft::WRL::ComPtr<ID2D1Device1> dev2d; Microsoft::WRL::ComPtr<ID2D1DeviceContext3> devCon3; Microsoft::WRL::ComPtr<ID3D11Device> dev; // the actual Direct3D device Microsoft::WRL::ComPtr<ID3D11DeviceContext> devCon; // device context Microsoft::WRL::ComPtr<IDXGIDevice> dxgiDevice;// to get the DXGI factory Microsoft::WRL::ComPtr<IDXGIAdapter> dxgiAdapter;// to ..

Read more

I have a MFC application where I use Direct2D to draw some images loaded from disk. When the application is started I create a IWICBitmapSource with this methode. IWICBitmapSource *Main::piGetIWICBitmap() { IWICBitmapDecoder *pDecoder = nullptr; _AFX_D2D_STATE* pD2DState = AfxGetD2DState(); HRESULT hr = pD2DState->GetWICFactory()->CreateDecoderFromFilename( sFullPath.c_str(), NULL, GENERIC_READ, WICDecodeMetadataCacheOnLoad, &pDecoder ); IWICBitmapFrameDecode *pSource = nullptr; hr = ..

Read more

HWND graph::createwindow() { FreeConsole(); glfwInit(); glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); glfwWindowHint(GLFW_VISIBLE, GLFW_TRUE); GLFWmonitor* monitor = glfwGetPrimaryMonitor(); const GLFWvidmode* mode = glfwGetVideoMode(monitor); glfwWindowHint(GLFW_RED_BITS, mode->redBits); glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits); glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits); glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate); glfwSetWindowMonitor(window, monitor, 0, 0, mode->width, mode->height, mode->refreshRate); window = glfwCreateWindow(mode->width, mode->height, "GLFW", monitor, nullptr); return glfwGetWin32Window(window); } I am trying to use glfw with direct2d. I wrote ..

Read more