I'm using Direct2D in C# to render a small gui framework for my research project. I'm not very used 开发者_如何学Pythonto working on Windows or with DirectX. I'm using a Windows Forms control to create a render target, and msdn warns that since it uses BindDC, a the larger the rendering target, the worse the performance will be (which turned out to be a dramatic difference, when I maximize the window, I get around 15 fps).
What would be a better way to create a render target for Direct2D? Is there a way to create a window and render directly to it, instead of rendering to a control's buffer first, and then rendering that? If so, how?
Sorry if my English sucks, not my native language.
You should be able to use CreateHwndRenderTarget instead, using the control's Handle property. To do it completely right, create your own control and override the OnHandleCreated() method. And override OnPaintBackground() and do nothing.
精彩评论