🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

How to create ID2D1Factory from IDXGIFactory1?

Started by
2 comments, last by Key_C0de 1 year, 10 months ago

I have a 3d d3d11 engine and I'd like to create 2d graphics from it as well.

Here's how I typically create the IDXGIFactory1:

Microsoft::WRL::ComPtr<IDXGIFactory1> m_pFactory;
HRESULT hres = CreateDXGIFactory1( __uuidof( IDXGIFactory1 ), reinterpret_cast<void**>( m_pFactory.GetAddressOf() ) );

Here's how I typically create the ID2D1Factory:

Microsoft::WRL::ComPtr<ID2D1Factory> m_pFactory;
HRESULT hres = D2D1CreateFactory( D2D1_FACTORY_TYPE_SINGLE_THREADED, __uuidof( ID2D1Factory1 ), &d2dOptions, &m_pFactory );

Is there a way to create an ID2D1Factory given an already created IDXGIFactory1?

My intention is to combine the 2d factory functions to draw 2d functions given the 3d engine, so I can use convenient 2d drawing functions like: DrawRectangle, DrawRoundedRectangle, drawEllipse, DrawText etc.

Thanks in advance.

None

Advertisement

Did you have a read the “Direct2D and Direct3D interoperability overview” article? This should go over the process of using D2D in combination with D3D.

@Juliean Thank you. I'll read it.

None

This topic is closed to new replies.

Advertisement