So much great info, thanks everyone! Still going through it and going through many tests to figure it out
Have you tried disabling alpha writes when you draw transparent graphics to the surface? I recently had a similar issue, and doing that fixed my problem.
GML:
gpu_set_colorwriteenable(true, true, true, false);
/* draw stuff to surface here */
gpu_set_colorwriteenable(true, true, true, true);
If you don't do this, it will change the alpha of everything drawn behind it when you draw sprites with alpha to the surface.
This is not a workable solution for me, because as the video mentioned, this technique only works if I'm drawing transparent elements to a completely non transparent surface which I'm not doing. Bc its just containing GUI elements, anything not a GUI element on the surface will be transparent. If I clear the surface to opaque black for example then use this it works, but then is there a way to remove all the black I added to make it transparent again?
Drawing transparent graphs on a surface will "corrode" it. Look at bm_normal blending formula:
Ao = As * As + Ad * (1 - As)
If Ad=1 we get:
Ao * 1 - As * (1 - As)
0 < As < 1 so 0 < Ao < 1, so the surface becomes transparent. Then you draw it to the screen and it blends with the black background, seeming strange.
Solution is:
gpu_set_blendenable(false);
draw_surface(...);
gpu_set_blendenable(true);
this also doesn't work for the same reasons as above. Anything that should be transparent turns to black which is no good for a surface that is supposed to be mostly transparent.
I've got similar issue with application surface, and solution was to use gpu_set_blendenable();
(false before draw, true after draw), but that might be useful only if you draw surface without transparent pixels (as that's what happens with application surface).
If that what happens with the App surface and the GUI draw basically draws on top of the app surface, which most likely has no transparent pixels, then perhaps an easy solution is to draw the application surface onto the surface I'm creating instead of draw_clear_alpha() it, that way I don't have to deal with any transparent pixels at all. There should really is no difference between redrawing the app surface again with the gui elements I need vs treating it like I'm layering a transparent surface with new elements on top of the application surface from a performance standpoint, right?
That's an interesting shift in thinking. Don't treat this like I'm an old school animator that has transparent cells that contain the character animation being layered on top of the background. Copy the background onto the surface, then draw the character on top of that. I'm going to give that a try
And you know what, now that I think about it, the application surface works differently because its not cleared to be transparent I'm pretty sure. The base layer of the app surface is black opaque, why else would you see a black void in games in spots where the application surface is not covered and it produces that copy effect? (because the app surface isn't cleared every step)