jarcode-foss / glava

GLava - OpenGL audio spectrum visualizer
GNU General Public License v3.0
1.17k stars 59 forks source link

Setting opacity documentation? #127

Closed mike391 closed 5 years ago

mike391 commented 5 years ago

How do I configure opacity on bars? There is no documentation that clearly states how to do this. There is #define USE_ALPHA but no clear indication of what values it takes and if thats what it does.

I want to set the opacity of the bars mod so that my wallpaper shows through a bit, im on budgie if that matters.

jarcode-foss commented 5 years ago

The confusion comes from an error on my part, apparently I did not commit a premultiply step into bars and graph, which should be there.

Ideally you have the following stage (2.frag) for the bars module:

#if USE_ALPHA == 0
#error __disablestage
#endif

#include ":util/premultiply.frag"

Where having USE_ALPHA set to 1 ensures the premultiply step is included. This has a minor performance penalty, hence the option to explicitly enable it if transparency colors are defined in bars.glsl.

As the comments suggest, this is only required for "native" transparency since X11 due to how it handles transparency. The above stage is automatically disabled in any other transparency mode.

To actually set transparent colors, you only need to add transparent bits onto the end of colors in any module config, for example #FF000070 is a mostly transparent bright red. If the alpha bits are omitted, then they are assumed to be FF (fully opaque). Alternatively, the final floating point value in a vec4 also corresponds to the alpha bits.

jarcode-foss commented 5 years ago

Since you pointed out the documentation being unclear from the comments/syntax, I added a section to the wiki: "Working with colors"

mike391 commented 5 years ago

Wow thanks! That's extremely helpful.