🎉 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!

Windows C++, Multiple Window Threads, Direct2D 11

Started by
0 comments, last by GfxProgrammer 3 years, 11 months ago

Hi-

I am using Direct2D 11, and I have created a window class that initializes its own D2D factory and a render target for the window handle, on its own thread. I have a message pump going in the thread function and it works fine if I dont use Direct2D - if i just launch the window on a new UI thread and paint with Win32. If I use D2D, I get a blank, transparent region where the window should be. Not exactly sure how to debug this.

I have been piecing together pieces from the internet (https://docs.microsoft.com/en-us/windows/win32/direct2d/server-side-rendering-overview?redirectedfrom=MSDN#multithreading​ and this https://docs.microsoft.com/en-us/windows/win32/direct2d/multi-threaded-direct2d-apps).​ The second one mentions D3 which I am not using.

I am not doing anything special:

  1. Create thread
  2. In thread function create the window, the factory and create the message loop.
  3. Paint to the render target in the WM_PAINT message.
  4. Paint a border in Win32 - this works.

I have a handler to manage the hittesting so I can resize (the window is borderless), and that isnt running which I think is related to the transparent window.

Any advice?

Thanks,

SP

Advertisement

It looks like the issue is the dwStyle param on CreateWindowEx. I am creating with WS_EX_LAYERED, which doesnt work if the window is not on the main thread. Not sure why.

SP

This topic is closed to new replies.

Advertisement