Search code examples
c++direct2d

What is the difference between CreateCompatibleRenderTarget and CreateHwndRenderTarget


I am just confused about the difference since, we can just make a bitmap the size of the window and then draw the image onto the window?


Solution

  • The difference is in the name: CreateCompatibleRenderTarget does just that in that it creates a render target that is compatible with the current display settings. CreateHwndRenderTarget conversely creates a RT that simply renders to a window. So it is not set up the same way as the compatible target.

    What is a render target?

    Even though that talks about XNA, most of the primitive information there is agnostic of even DirectX and simply discusses the idea of a render target.