I’m using direct3d vertex format where color is 32 bits integer (ARGB). I want to redirect vertices stream to OGL renderer but I have problem with color - is it possible to use ARGB packed color (32 bit integer) in OpenGL ??
chanel | alpha | red | green | blue |
bits | 24-31 | 16-23 | 8-15 | 0-7 |
There is no way. You can use ARGB as texture data, but not for vertex colors.
You must convert the colors to OpenGL’s format.
//still not advanced
unsigned int
make_GLish_color(unsigned int DXish_color)
{
return((DXish_color&0xFF00FF00)|
((DXish_color&0xFF0000)>>16)|
((DXish_color&0xFF)<<16);
}
I guess this post is one big confusion. So, you have got a windows-sheme texture and you want to upload it to opengl, right?
Use BGRA - that’s what you need:
B G R A
0-7 8-15 16-23 24 - 31
No, he’s got ARGB vertices. You can’t feed those to the GL at all. You could do the swizzling in a vertex program, but it’s better to do it manually on load, as zeckensack explained, so that you can forget about it at runtime.