I need to create instances of colors so i can display the color value at different positions(height). I have found a section of code in Java that pretty much does exactly what I want to do, but i need it in C++, and i know that the opengl function calls are not the same, but have no idea what they are.
JAVE CODE:
private RGB blue = new RGB (0.0, 0.0, 1.0);
private RGB green = new RGB (0.0, 1.0, 0.0);
private RGB white = new RGB (1.0, 1.0, 1.0);
public RGB getColor (double i, double j) {
double a = getAltitude (i, j);
if (a < .5)
return blue.add (green.subtract (blue).scale ((a - 0.0) / 0.5));
else
return green.add (white.subtract (green).scale ((a - 0.5) / 0.5));
}
How can i create those instances in C++ and does c++ have functional calls, like the ones used in the java script, i.e. “blue.add”, “green.subtract”.
Thank you very much for your help.