PDA

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



clzz
06-04-2004, 11:33 PM
Now I have a color of GLubyte.
I will use it in glClearColor(..).
???

IronicResearch
06-05-2004, 09: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.

clzz
06-05-2004, 08: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