How can i highlight a single Texture?

Hey

Im currently coding my own GUI for my game and i want to highlight a texture (single texture, it could be, that one texture is transposed multiple times) if the mouse hovers the texture.

Does anyone has ideas of how to highlight a 2d element?

My idea was to add a bit of white (vec4(0.3, 0.3, 0.3, 1.0)) to the texture-Color when hovering the texture.
But this is not good, because all elements gets a bit more white

Thanks for any ideas

Greetings

Fabi

Don’t know how about mouse and open gl, but when I did GUI with the keyboard I did something like this


for(int i = 0; i < menuOptions.size(); ++i)
{
        if(activeOption == i) {
            option.setColor(r, g, b, a); // r g b a - colors when option is active, if going mouse if cursor is on the option
        } else {
            option.setColor(rgba); // rgba - when cursor is not on the option
        }

         //or you can use 
         //activeOption == i ? option.setColor(rgba) : option.setColor(rgba) 
         //it means exactly the same
}

also you can leave colors and just mix alpha value, for example if option is selected alpha = 255 else alpha = 100, or the dimension, if option is selected w = 100 and h = 50 else w = 50 and h = 25

also there is [C++/OpenGL] 2D Platform Engine - YouTube engine which is not so good, because he uses glBegin for drawing but you could get some GUI stuff

However you want. Realistically, you need something which fits the colour scheme in use (e.g. if everything is fairly bright, lightening the colours will often make something stand out less rather than more).

Well, you need to either draw the highlighted portion separately or have some other way to allow different primitives to be styled differently (e.g. vertex attributes).