Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Color Bar

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2003
    Location
    ames
    Posts
    3

    Color Bar

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

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,096

    Re: Color Bar

    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!!!

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2003
    Location
    ames
    Posts
    3

    Re: Color Bar

    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •