Need help to supply colors as unsigned char...

Hello…

I have data that have colors as unsigned char for
RGBA (from 0 to 255).

I would like to know if there is a way to supply those to glColorPointer()…

For now, unless I change the data format, the only way I can supply a color is:

  
glColor4f((currColor.red * ONEOVER255), (currColor.green * ONEOVER255), (currColor.blue * ONEOVER255), (currColor.alpha * ONEOVER255));

No need to say that all of these conversions to float variables are not really effficient…

And unless I create a new array at run-time, with
these conversions, I cannot use glColorPointer…

Can someone help me ?

where is the problem? you can set the second parameter, which defines the data type, to GL_UNSIGNED_BYTE.

Ok… I’ll try it…

It works… Thanx. I did’t tought it was so simple.

Is there a way to supply them with glColor, instead of using glColor4f ? I still some have
helper objects rendering functions that still render primitives with glBegin and glEnd, and I want to remove the conversion thing…

Just use glColor4ub.

-Evan