endian.txt 1.25 KB
Native mode of SGI machines are Big Endian in bit ordering AND byte ordering.
Therefore

	 -------------------------------
	| byte0	|	|	| byte3	|
	 -------------------------------
	MSB			      LSB

Open GL can actually deal with machines that have Little Endian in either bit
or byte ordering. Page 245 of OpenGL Programming guide.

For 32 bit 4 component color (RGBA) in Native SGI endianness, each pixel/texel
in memory looks like

	 -------------------------------
	|   A	|   B	|   G	|   R	|
	 -------------------------------
	MSB			      LSB

There is no reason whey we could not have done it the other way, just tradition
I guess and there is no advantages or disadvantages either way.

However, for < 32 bit color components, the Native SGI Bigendianness make data
much easier to read when programming. This is bacause bit/byte big endian read
naturally from left to right. For example, if I wanted to make 1 bit deep image
that looks like this on the screen

	11110000 00000000 00000000 00000000

I can define it in a 32 bit word as 0xf0000000, This works particular well can
someone is trying to convert patterns into a bitmap since left side of the
bitmap is just left side of the data word.

Naturally, all subwords (byte/shorts ...) of a words should be the same endian.