Color Bar

Is there any C++ source code available to output OpenGL Temperature bar. Please help!!!

Is this for like a class project?

I have done some code in the past to help someone with this same type problem.

Do you need a scale along with your bar?

You can use a quad to draw the bar, and adjust the lenght based on temp.

glBegin(GL_QUADS);
glVertex2f(0,0); //Start point
glVertex2f(temp_value, 0); //Adjust temp_value between x/y depending on which direction to draw bar.
glVertex2f(temp_value, 5); // 5 = width of bar
glVertex2f(0,5); // Last point on quad
glEnd();

You can use another quad with a diffrent color place behind this one for a background.
Also you load a texture with a scale on it.

Hope this helps.

Originally posted by balas:
Is there any C++ source code available to output OpenGL Temperature bar. Please help!!!

thank you nexus,
it is for a class project kinda thing. I need a color bar, whose colors keep changing dynamically with respect to increase in temperature/pressure etc., I will try your code.

thanks
BALU

Originally posted by nexusone:
[b]Is this for like a class project?

I have done some code in the past to help someone with this same type problem.

Do you need a scale along with your bar?

You can use a quad to draw the bar, and adjust the lenght based on temp.

glBegin(GL_QUADS);
glVertex2f(0,0); //Start point
glVertex2f(temp_value, 0); //Adjust temp_value between x/y depending on which direction to draw bar.
glVertex2f(temp_value, 5); // 5 = width of bar
glVertex2f(0,5); // Last point on quad
glEnd();

You can use another quad with a diffrent color place behind this one for a background.
Also you load a texture with a scale on it.

Hope this helps.

[/b]