Im using glColor4f(1.0f, 1.0f, 1.0f, alpha_);
to set transparency to primitives I'm drawing.
However I'd like to be able to read the current opengl alpha value. Is that possible?
e.g.
float current_alpha = glGetAlpha(); //???
glColor4f(1.0f, 1.0f, 1.0f, alpha_*current_alpha);
The currentcolor keyword represents the value of an element's color property. This lets you use the color value on properties that do not receive it by default. If currentcolor is used as the value of the color property, it instead takes its value from the inherited value of the color property.
If you need to change the color, you only need to do it in one place (i.e. on the color property). All the currentcolor references will automatically use the new color. That probably looks like a pretty useless example, as the text and background are now the same color. You won't be able to see the text.
currentColor is useful when you want a certain color to be consistent in an element. For example, if you want an element to have a border color that's the same as the element's text color, using currentColor makes a lot of sense because then if you decide the main text color you can change the value at only one place.
The currentcolor keyword refers to the value of the color property of an element.
Either you store the last alpha value you sent using glColor4f
, either you use:
float currentColor[4];
glGetFloatv(GL_CURRENT_COLOR,currentColor);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With