[Bf-committers] Re: image editor / draw alpha

Ton Roosendaal ton at blender.org
Wed Jun 14 16:27:49 CEST 2006


Hi,

>>    /* swap bytes, so alpha is most significant one, then just draw it
>> as luminance int */
>>    glPixelStorei(GL_UNPACK_SWAP_BYTES, 1);
>>    glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_LUMINANCE,
>> GL_UNSIGNED_INT, recti);
>>    glPixelStorei(GL_UNPACK_SWAP_BYTES, 0);
>> }
> This might be an endianness issue. The trick used here is to make
> alpha the most significant byte, so that after rounding the RGB part
> will just be ignored. On big endian alpha is the least significant  
> byte,
> so it needs to be swapped. On little endian the swap is not needed.
>
> So I guess you're using Intel or another little endian processor, and
> Ton tested this on his Mac OS X PPC?

Aww.., yes I should have made it check for endianness first.

Branan: the tracker report misses an attachment, it's the stupid "Check  
to Upload etc" button people always forget. :)
So I cannot review your code, but an endian check in Blender is done  
everywhere with a line like:

if (G.order == B_ENDIAN)

Thanks for finding the issue anyway!

-Ton-

------------------------------------------------------------------------ 
--
Ton Roosendaal  Blender Foundation ton at blender.org  
http://www.blender.org



More information about the Bf-committers mailing list