|
Transparent windows |
urskogshumla
Member #16,942
January 2019
|
Hi! So, when developing with GLFW on linux, it was very straightforward to achieve this goal. I just used the GLFW_TRANSPARENT_FRAMEBUFFER window hint and a glClearColor with an alpha of 0.0, fired up my compositor and it was working dandy. Now, all cozy with allegro instead, I can't find any such solutions. So my question is: Are there any? And follow up question: Can allegro alternatively use a glwf window to do its rendering? If so; then I could just spin up a glfw window, tell allegro to use that rendering context/window, and use glClear/hints/clearcolor as usual. Is this possible? I'm pretty new to the allegro library, so sorry if these are questions with obvious answers or so. Hugs |
Edgar Reynaldo
Major Reynaldo
May 2007
|
The key to transparent windows is the gl context creation. Since allegro doesn't support using a custom context, you can't currently do it with Allegro. However, allegro can still give you a HWND on Windows, which you can use to set the window properties and the color key which allows shaping the window with a single transparent color. This does not work for translucency though, for that, again, you need a custom gl context. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
urskogshumla
Member #16,942
January 2019
|
Thank you! I downloaded the git version of allegro from the arch user repositories instead, and made a few changes with help from a GLX example by datenwolf: GLX example: https://github.com/datenwolf/codesamples/blob/master/samples/OpenGL/x11argb_opengl/x11argb_opengl.c And I ended up with translucent windows, using ALLEGRO_ALPHA_SIZE 8, al_map_rgba colors and compton as compositor. Hugs |
Edgar Reynaldo
Major Reynaldo
May 2007
|
So that gray square is your transparent window? Neat! Do you think you could do the same for Windows? I don't know the specifics of making a WGL context transparent, but it would be awesome if Allegro could do this for all platforms. For OpenGL at least. EDIT Which shows a few different ways. I never used dhpoware's demo code because I didn't understand pbuffers. It looks like all you have to do is change the PIXELFORMATDESCRIPTOR a little bit before you pass it to the rest of the routine. Maybe I can make a patch for this, not sure. I've made transparent mice windows before using DIBs but that is no good for anything larger than an icon. And it's way too messy trying to bitblt to the HDC all the time. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
urskogshumla
Member #16,942
January 2019
|
Nice! I haven't had a windows machine since elementary school; so I am of no help in that department. But if someone more windows-oriented makes a patch then maybe we could begin to formulate some kind of PR? And yeah, transparency totally is neat, for example it makes live overlays possible during screen capture (logos, info, key presses and such). I myself am doing some kind of interactive audiovisual thing for a concert, using a lot of nodes in separate windows that react to screen position and each other. It aint the most beautiful solution but hey, it utilizes the existing window manager for dragging the nodes around, that idea has got to score some unix philosophy points Hugs |
Edgar Reynaldo
Major Reynaldo
May 2007
|
I found datenwolf's wglarb demo, and I'm trying to get it to work as we speak. Right now it draws a white window, not a transparent one, so it's not working yet. As for the PR, for X11, you'd need to incorporate the changes into the window creation system. Can't just enable translucency for every window. On #allegro on IRC on freenode, I was talking to SiegeLord, and he said adding ALLEGRO_TRANSLUCENT_WINDOW to the new display flags was okay. But the meat of the matter still needs to be implemented. EDIT This (https://pastebin.com/BfaHf1NJ) is one way to do it using PFD_SUPPORT_COMPOSITION, and it works on Vista up, simply by asking for a different pixel format. You can see it here : {"name":"WNhv2if.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/5\/a5a937eda446b908fdffe4292fd0a591.png","w":1403,"h":509,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/5\/a5a937eda446b908fdffe4292fd0a591"} EDIT2 I'm in the process of modifying a local fork of Allegro 5. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
|