Most common pixel format?
BlitzMax Forums/BlitzMax Programming/Most common pixel format?
| ||
What is the most common pixel data format, and on what platform? RGBA? ARGB? |
| ||
Before assuming anything, just use pixmapformat and you can tailor your routines to run on any computer. |
| ||
Yeh AD, having had a quick look through some of the image loading routines, it seems some systems store data as GRB - so you can't really assume anything ;] |
| ||
I'm not using pixmaps, I have my own bitmap system. The reason I ask about the format is because I figured if there are more computers using one particular format then I will optimize for those ahead of the others so that there is less likelihood of having to convert things all the time. Having said that, I suppose that in order to upload a texture to OpenGL I have to define it's source format and OpenGL handles the on-the-fly converson, so I guess it doesn't matter too much. But if OpenGL is slowed down in any way but trying to draw an RGBA texture rather than an ARGB texture I'd like to know. |
| ||
Bump. What is the most common format? Do most PC cards use ARGB? What does the Mac use? |
| ||
Seems like it's ARGB most commonly |
| ||
Many of the Macs use the same video adapters as PC's do (Radeon 9x00), so I would expect them to be the same? |
| ||
And that same format IS???????????? |
| ||
Mine is GRBA (GeForce 6600). I don't think it's safe to assume anything. |
| ||
Win32 (little endian) : BGRA MacOS (big endian) : RGBA Fun stuff! |
| ||
MacOS (big endian) : RGBA So... Any idea if Apple will also change over to little endian when they switch to Intel CPU's in the not-too-distant future? Isn't the big/little endian-ness tied to the CPU architecture, and not operating system? |
| ||
Wait, is alpha the "leftmost" or "rightmost" byte? If you have a byte representing alpha do you have to shift it to the left or keep it where it is? |
| ||
It probably is for efficiency's purposes, where you usually want to access the RGB more often than the A, so you put the RGB in the first-accessed bytes, be they in the little end or big end. I guess it doesn't matter too much. I prefer the RGBA mac way but maybe doing stuff in ARGB is more efficient, coding-wise. |
| ||
Oh OK, so it's just an endian thing. And yes, xlsior, if Apple switch their OS to Intel, so will their endianness change. |