Open krystalgamer opened 8 years ago
This sort of thing works well in software-based APIs like GDI and Allegro 4, but when using OpenGL and Direct3D like Allegro 5 does, this can't be done without shaders. You can write a shader that substitutes a colour for transparent, but I think it's not appropriate for the default shader to do so for various reasons (speed, backwards compatibility, etc...)
The other option is you can use al_convert_mask_to_alpha after you load your graphics. Pass it the colour you want to be transparent. You must make sure the bitmaps have an alpha channel.
@trentg Thanks for quick answer. I tried what you said with a full pink file(800x600 RGB(255,0,255) and converted its mask to alpha, but it gave me a black screen.My ideia by now is modify the rendering of some opengl functions with this http://stackoverflow.com/questions/4052940/how-to-make-an-opengl-rendering-context-with-transparent-background.(Of course i won't just copy paste it)
So you want the window itself to be transparent? In that case yeah, it's possible but I don't know the specifics... you'd have to modify the platform specific window creation on Windows, Mac and Linux for it to be accepted into Allegro (you could start with one and see if someone else would do the others.)
EDIT: this looks like the key portion of your link:
SetLayeredWindowAttributes(hWnd, 0x0, 0, LWA_COLORKEY)
Good luck.
@trentgt thanks again. I'll explain why i need this. Im an external hack for csgo with an ESP
(here's an example: http://images.akamai.steamusercontent.com/ugc/618471980841380516/6D78510B7C852B66A58AC22E4DF41E3E2EFE625D/) and way of doing it is converting the coordinates of game from 3d to screen and then drawing. I decided to use allegro since is the library that i know how to use(partially)
I'll try what you've said and update this post.
Allegro doesn't support yet a color in the backbuffer that when rendered is transparent. Other libraries support this specially GDI. Is this a thing that can be easily made? If someone point me in the right direction by telling me which functions i should change(im a little lost) i think i can do it. Thanks.