
Color4 endian
Posted Sunday, 30 January, 2011 - 16:37 by tekord inGot a problem with color endian. How can I swap it? When I pass array of Color4 into GL.ColorPointer and draw objects it takes colors in wrong sequence. Red becomes Alpha, Green becomes Blue, ect. Does OpenGL supports endian swapping?
Have any ideas about solution?


Comments
Re: Color4 endian
I was looking for solution on this forum and found a node with same problem that don't have answares. (but have a pictures).
Re: Color4 endian
OpenGL is supposed to store color components in RGBA order - the same as Color4. As far as I know, endianness does not change this: it only affects the order of the bytes within a single color component, e.g. R, if it happens to be larger than 1 byte.
What video card and driver are you using? Which OS & CPU? Does the issue appear on different video cards?
You can work around this issue in one of two ways:
OpenGL does not offer a way to set the order of components in
GL.ColorPointer, since it is always expected to be RGBA. It offers functions to set the endianness and component order of texture data via theGL.PixelStorefamily of functions.(Edit) This extension looks promising: http://www.opengl.org/registry/specs/EXT/vertex_array_bgra.txt
Re: Color4 endian
I using Windows 7, but I can't test program on other cards. Thanks for answare, now I have some ideas :).
Re: Color4 endian
x86 and x64 are both little endian and Color4 works definitely correctly there. Why do you assume you have a problem with endianness?
Re: Color4 endian
x86 and x64 are both little endian and Color4 works definitely correctly there. Why do you assume you have a problem with endianness?
I code whole day and tired :). Problem not in endian, just in color format.