union { unsigned char components[4]; unsigned long rgba;}PixelUnion;// "texture" is of type unsigned long...offset = (tv * tex_width) + tu;PixelUnion.rgba = texture[offset];// PixelUnion.components[0], PixelUnion.components[1], PixelUnion.components[2] and PixelUnion.components[3] are the components
Byte manipulation question. I *should* know this...
Or you could maybe use a union:
Quote:Original post by Vortez
Why not simply do this?
offset = ((tv * tex_width) + tu) * 4;
memcpy(buffer, &texture[offset], 4);
or even
UINT *pData = (UINT*)&texture[offset];
*buffer = *pData;
That's great if all I'm doing is copying from the texture to the offscreen bitmap. However, if I want to do any blending or filtering of the texture, I need the components.
Quote:Original post by BigJim
Or you could maybe use a union:
*** Source Snippet Removed ***
Interesting...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement