>> BMP uses BLUE, GREEN, RED, UNASSIGNED That's the byte order, which correspond on little endian machine, which Windows (BMP origin) runs, to B*256^0 + G*256^1 + R*256^2, or if B=BB, G=GG, R=RR (two-digit hex), in J base notation: 16bRRGGBB. Thus, (R,G,B) = 256 (#.^:_1) 16bRRGGBB and that's the argument to glcolor. My point was that if you pass 16bff0000 to viewrgb, you get color blue. And is this expected or not?
P.S. BMP is used with viewmat because there is tight integration of it with bmp.ijs, and they need to work in sync. Although BMP is a Windows creation, it is supported by other platforms and browsers, because it's widestpread and easy to create without special graphics libraries. ----- Original Message ---- From: "Miller, Raul D" <[EMAIL PROTECTED]> To: Beta forum <[email protected]> Sent: Wednesday, June 21, 2006 11:37:25 AM Subject: RE: [Jbeta] viewrgb colors 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 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
