Skip to main content
added possible solution
Source Link

I want to create a pause menu where everything in the background gets darker. I've looked up a bunch of possible solutions (even the second page on google) but it doesn't seem to work. I do already have something in my code that makes a single texture darker when hovered over, by calling: GL11.glColor3f(alpha, alpha, alpha); before drawing vertices. What I want to achieve is everything getting darker, so when hovering over a texture it should be even darker than before so it is still darker than the rest in the background when that has been made darker because of a pause menu that pops up.

Another thing I noticed is that glColorMask(true, false, false, true); does not get overridden and blends colours everywhere, so I was wondering if there is a version of this method that puts a transparent black overlay so everything becomes darker. I have enabled blending.

-Edit-

One solution I came up with (not just now) is multiplying alpha in every glColor3f function with a variable that is smaller than 1 so everthing gets relatively smaller, but I worry about this being uneffective and badly mantainable

I want to create a pause menu where everything in the background gets darker. I've looked up a bunch of possible solutions (even the second page on google) but it doesn't seem to work. I do already have something in my code that makes a single texture darker when hovered over, by calling: GL11.glColor3f(alpha, alpha, alpha); before drawing vertices. What I want to achieve is everything getting darker, so when hovering over a texture it should be even darker than before so it is still darker than the rest in the background when that has been made darker because of a pause menu that pops up.

Another thing I noticed is that glColorMask(true, false, false, true); does not get overridden and blends colours everywhere, so I was wondering if there is a version of this method that puts a transparent black overlay so everything becomes darker. I have enabled blending.

I want to create a pause menu where everything in the background gets darker. I've looked up a bunch of possible solutions (even the second page on google) but it doesn't seem to work. I do already have something in my code that makes a single texture darker when hovered over, by calling: GL11.glColor3f(alpha, alpha, alpha); before drawing vertices. What I want to achieve is everything getting darker, so when hovering over a texture it should be even darker than before so it is still darker than the rest in the background when that has been made darker because of a pause menu that pops up.

Another thing I noticed is that glColorMask(true, false, false, true); does not get overridden and blends colours everywhere, so I was wondering if there is a version of this method that puts a transparent black overlay so everything becomes darker. I have enabled blending.

-Edit-

One solution I came up with (not just now) is multiplying alpha in every glColor3f function with a variable that is smaller than 1 so everthing gets relatively smaller, but I worry about this being uneffective and badly mantainable

Source Link

OpenGL color overlay

I want to create a pause menu where everything in the background gets darker. I've looked up a bunch of possible solutions (even the second page on google) but it doesn't seem to work. I do already have something in my code that makes a single texture darker when hovered over, by calling: GL11.glColor3f(alpha, alpha, alpha); before drawing vertices. What I want to achieve is everything getting darker, so when hovering over a texture it should be even darker than before so it is still darker than the rest in the background when that has been made darker because of a pause menu that pops up.

Another thing I noticed is that glColorMask(true, false, false, true); does not get overridden and blends colours everywhere, so I was wondering if there is a version of this method that puts a transparent black overlay so everything becomes darker. I have enabled blending.