PDA

View Full Version : Dynamic colors in OpenGL?



Flotonic
06-21-2011, 04:36 PM
glColor3f(1,0,0);

I know that this is red, represented as 255. If I want to use 0x7F 0x0 0x0 for the colors, I would just need to divide each by 0xFF and get their decimal values and put those.

What I'm asking is for the name of a command type thing similar to glOrtho that allows me to set the range from 0 to 255 so I can simply use 127 instead of having to divide by 255 and use as a decimal. Any ideas?

Thanks in advance.

Alfonse Reinheart
06-21-2011, 05:08 PM
What I'm asking is for the name of a command type thing similar to glOrtho that allows me to set the range from 0 to 255 so I can simply use 127 instead of having to divide by 255 and use as a decimal.

There isn't one. But you can just use glColor3ub, which takes unsigned bytes instead of floats.

Flotonic
06-21-2011, 05:14 PM
Thanks a lot! :D