PDA

View Full Version : Color Bar



balas
04-10-2003, 07:25 PM
Is there any C++ source code available to output OpenGL Temperature bar. Please help!!!

nexusone
04-11-2003, 08:47 AM
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!!!

balas
04-15-2003, 12:36 PM
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:
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.