Home > Enterprise >  Storing glut color in variable
Storing glut color in variable

Time:01-19

Is there any way to store a glut color in a variable, like instead of doing this:
glColor3f(1.0, 1.0, 1.0);
being able to do this:

glColor white = glColor(1.0, 1.0, 1.0);
glColor3f(white);

which in turn creates much more readable code

CodePudding user response:

I suggest to store the color in an array and set the color with glColor3fv:

float white[3] = {1.0f, 1.0f, 1.0f};
glColor3fv(white);
  • Related