Hi Glenn,

I think what these functions *should* return can not be determined by
the names of the functions. They return 32 bit integers and whether the
low byte or the high byte corresponds to the first color channel named
is not immediately obvious. Like you, my first guess would be that the
high byte has the first named color channel so that asRGBA() would
return 0xff for opaque black. As you have discovered, this is not what
happens.

However, on little-endian architectures (like the dominant x86) writing
this 32 bit value to memory results in the bytes being ordered as in the
function name. This is very useful, although not entirely portable.

I would not recommend changing these functions' behaviors since that can
easily break any existing code that uses them. New functions with more
descriptive names could certainly be helpful. Documenting these
functions is also a good idea so other users don't waste too much time
wondering why their code does not behave as expected.

Mark


On 9/16/2010 11:53 AM, Glenn Waldron wrote:
Hi folks,

Tthe methods Vec4f::asABGR() and asRGBA() appear to be reversed. (That
is, asABGR() returns RGBA and vice-versa.) Can someone lay another
pair of eyes on them and confirm this?


Glenn Waldron : Pelican Mapping : +1.703.652.4791

This message and any attachments are solely for the intended recipient and may 
contain confidential or privileged information. If you are not the intended 
recipient, any disclosure, copying, use, or distribution of the information 
included in this message and any attachments is prohibited. If you have 
received this communication in error, please notify us by reply e-mail and 
immediately and permanently delete this message and any attachments. Thank you.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to