View Full Version : How to change GLubyte to GLclampf ?(color)

06-05-2004, 12:33 AM
Now I have a color of GLubyte.
I will use it in glClearColor(..).

06-05-2004, 10:05 AM
You would need to scale the GLubyte values which ranges from 0 to 255 to the equivalent GLfloat values which would be clamped in the range from 0.0 to 1.0;

ie, (GLfloat) (value) / 255.0

You should probably refer to the docs on the glColor* APIs for how color values can be repesented in either integer or floating point formats.

06-05-2004, 09:37 PM
Thank you!
I have solved this problem.
My code is:
glClearColor((float)GetRValue(m_colBackColor)/255,(float)GetGValue(m_colBackColor)/255,(float)GetBValue(m_colBackColor)/255, 0.5f); // Black Background