Oleg Kobchenko wrote:
> load 'viewmat'
...
> From experience with HTML colors and BMP byte layout
> for 24 bit encoding, as well as in GL2, for example,
>
> glcolor 256 (#.^:_1) 16bff0000
> 256 (#.^:_1) 16bff0000
> 255 0 0
>
> this should be RED. But it's not what we see in viewrgb.
I would not refer to BMP in this context.
BMP arranges color values within a pixel in reverse order
from most modern graphics hardware uses.
Graphics hardware typically has the color values within a
pixel arranged as RED, GREEN, BLUE. BMP uses BLUE, GREEN,
RED, UNASSIGNED. (OpenGL uses RED, GREEN, BLUE, ALPHA).
That said, intel uses reverse byte order, which means that
256#.a.i.'abcd' produces, in memory, the character sequence
'dcba'.
In other words, given the number 16b00112233, the layout in
memory on an intel machine would be 16b33 16b22 16b11 16b00{a.
Likewise, given the number 16bff0000, the layout in memory on
an intel machine would be 16b00 16b00 16b00 16bff{a. This
corresponds to what you would expect for a 24 bit pixel in
a modern video card.
---
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm