How to change GLubyte to GLclampf ?(color)

Now I have a color of GLubyte.
I will use it in glClearColor(…).
???

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.

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

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.