0

I am trying to use this Acrylic Effect in an OpenGL/GLFW Context, the only approach I can think of is rendering the backdrop of the window by Direct Composition and saving it in memory, which can be used by a FrameBuffer Object in OpenGL.

How can I render a dCompDevice to a memory location ?

AlephNot
  • 138
  • 7
  • *"the only approach I can think of"* - There's at least one other approach: Don't. Just don't. Introduced in Windows Vista, and a major selling point for Windows 7 Ultimate, the acrylic brush effect was garbage back then as much as it is today. I will publicly apologize to anyone who can produce solid evidence that a translucent UI actually improves usability. Until then I will call it a distraction that burns watts in return for nothing, and that is a pretty conservative estimate. – IInspectable Feb 08 '22 at 05:04
  • Yeah i agree the acrylic has no usability , but it does look cool . Also the repo I linked takes a screenshot of all windows below using a private dwmapi. – AlephNot Feb 08 '22 at 06:03
  • This sample is outdated and uses undocumented stuff. Direct Composition is the old thing, use Windows.UI.Composition (WinRT API but accessible from regular "desktop apps"). You create a CompositionDrawingSurface, draw on it, cast it to ICompositionDrawingSurfaceInterop2 and copy to a 2D texture: https://learn.microsoft.com/en-us/windows/win32/api/windows.ui.composition.interop/nf-windows-ui-composition-interop-icompositiondrawingsurfaceinterop2-copysurface – Simon Mourier Feb 08 '22 at 07:31
  • @SimonMourier Hey, I am quite new to this stuff , and I dont understand how to create and link the surface to the window with only the hwnd . Also noticed this [Backdrop brush](https://learn.microsoft.com/en-us/uwp/api/windows.ui.composition.compositionbackdropbrush?view=winrt-22000) that along with the gaussian blur provided in the example can create close to an acrylic background. Could you please provide barebones code that shows how to link a window to a Compositor – AlephNot Feb 08 '22 at 12:06
  • you can have a look at this: https://github.com/aelyo-softworks/Wice it's pure C# but uses native code, obviously. Relevant code is mostly in Window.cs and Visual.cs – Simon Mourier Feb 08 '22 at 12:56
  • @SimonMourier I am having trouble setting up Win2D and creating Effects. Could you help me out on [this question](https://stackoverflow.com/questions/71115485/win2d-effects-in-ui-composition-c) – AlephNot Feb 15 '22 at 06:45

0 Answers0