Sign in to follow this  
anupgupta

Opengl Image

Recommended Posts

hello everyone

currently i have an image of a car, truck and bike. after collision i have to blink the image with becoming white and back to original. using opengl function

glColor4f(color.red, color.green, color.blue, color.alpha);

i was able to change the image to red or green or blue or other color combination using these 3 colors. I would like to know as to how could i change the color to white(image to white).

for the primitives, the same function gives me white to any color combination but does not get white for image.
Any suggestion would be of great help as to how do get the image to white color.

Share this post


Link to post
Share on other sites
Are you saying you want to convert the image to gray scale (black and white?)

If so, then it would go something likes this:

float gray = color.red * 0.299 + color.green * 0.587 + color.blue * 0.114;
glColor4f(gray, gray, gray, color.alpha);

Share this post


Link to post
Share on other sites
Quote:
I'm not too familiar with OpenGL, but assuming the values get through to the hardware and aren't clamped glColor4f(255.0f, 255.0f, 255.0f, 1.0f) should do the trick.


The values are clamped by the HW, this is the same as color4f(1,1,1,1).

anupgupta, you have to explain more exactly what you mean. If you have a 'pure white image' than you have no image at all, just a white square. I don't think this is really what you want.

Share this post


Link to post
Share on other sites
Hey anupgupta,

Unless you feel like running your image through a fragment shader, which will probably be the fastest way to do it,
You need to blend the image with a white quad of the same dimensions.

edit: Fixed typo.

[Edited by - SuperVGA on October 12, 2010 12:56:56 PM]

Share this post


Link to post
Share on other sites

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