Sign in to follow this  

How to do a "blend"

This topic is 4713 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello! I'm quite new to openGL and i want to do a special type of blending. I have buttonlike component, and when the mouse enters the client area I want to increase the pixelvalues for all pixels in the client by x steps. The button is drawn with lines, quads, and text. Any ideas? Check the 'X' (close window) on your windows in XP. When the mouse hoovers the button lightens up. And, is there any WM_ -message I can use to see if the mouse enters the component? WM_MOUSELEAVE does half the job...but the first half?

Share this post


Link to post
Share on other sites
Not 100% sure what you mean but here goes:


GLfloat intensity = 0.3;

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE); // Additive blending

glBegin(GL_QUADS);
glColor4f(1.0, 1.0, 1.0, intensity);
/* here go the coordinates of the quad-shaped
area that you want brightening */
glEnd();

glDisable(GL_BLEND);



The variable intensity (used for the Alpha component of the colour) specifies the amount by which to multiply each source colour component before adding it to the destination pixel's component. You can use this to control the brightness of the button.

Hope that was what you're looking for.

Share this post


Link to post
Share on other sites
You could render an untextured, white quad over the area you want to highlight, alpha blended with an alpha value of, say, 32. You'll lose some colour definition though. Or you could render the same image again over itself, with the blend mode set to additive for a slightly different visual effect. Again, you could modulate the alpha channel as necessary.

From memory, I think there's a WM_MOUSEHOVER message, which you should be able to use to achieve what you want.

Share this post


Link to post
Share on other sites

This topic is 4713 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this