Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Transparent back buffer.

This thread is locked; no one can reply to it. rss feed Print
Transparent back buffer.
Gnamra
Member #12,503
January 2011
avatar

I'd like to make the display / back buffer transparent, all of the solutions I found on this were for Allegro 4 except for one:

  SetWindowLong(al_get_win_window_handle(display), GWL_EXSTYLE, GetWindowLong(al_get_win_window_handle(display), GWL_EXSTYLE) | WS_EX_LAYERED);
  SetLayeredWindowAttributes(al_get_win_window_handle(display), 0, 0, LWA_ALPHA);

Problem with this one is that it makes the entire window transparent, so anything I draw is also transparent.

And it will only run on Windows, which isn't the worst thing even though I'm planning on having my program be cross platform compatible. It just means I'll have to spend some more time looking at X11 and whatever mac uses.

To sum it up:
Is there a way to make my back buffer transparent so that the desktop is visible?
Like this:

al_clear_to_color(al_map_rgba(0,0,0,0));
//draw stuff
al_flip_display();

Edgar Reynaldo
Member #8,592
May 2007
avatar

Gnamra
Member #12,503
January 2011
avatar

I was able to solve my problem but I had to give up on Allegro.

I used the glLayeredWindows demo to handle all of the drawing for me and modified it so I could put it in a class and use it in my project.

I also used lodepng to load the png files I'm using in my project.

I hope this will make it easier for others who wish to do the same.

beoran
Member #12,636
March 2011

This is indeed a missing Allegro feature. Transparent windows are possible on Linux and Windows, (and likely OSX) so we should probably implement this... one day.


http://stackoverflow.com/questions/9363491/how-to-make-transparent-window-on-linux

Go to: