質問

I am currently creating a D2DFactory with

D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &Direct2DFactory);

and using Direct2DFactory to create a render target on my main window using:

Direct2DFactory->CreateHwndRenderTarget(
    D2D1::RenderTargetProperties(),
    D2D1::HwndRenderTargetProperties(WindowHandle, size),
    &RenderTarget
);

I am attempting to draw from multiple classes to multiple parts of this window, at the minute, i am holding a list of all of these classes and calling OnRender for every one of them and passing RenderTarget as a param.

Is there a better way to do this? Can i create more than one render target, and then render those render targets with my main RenderTarget?

役に立ちましたか?

解決

What's your current problem? boring of passing so many render target parameters? I think this is cheap than creating multiple render targets, just like the D3DDevice object in Direct3D apps, nearly every render-able class need a device object to manage resource and do rendering work, the most common way is to pass a device parameter to each class instead of creating multiple devices. so i think you are on the way.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top