From: Alex Hill (spacecat++at++mindspring.com)
Date: 08/02/2001 07:36:30
Dear sirs,
I am trying to overwrite single pixel values in a pfTexture.
The texture was loaded from a standard SGI rgb file.
I have found that the PFTEX_INTERNAL_FORMAT is PFTEX_RGBA_4 which I believe
is a 16-bit texel with 4 bits each for RGB and A.
I get the unsigned integer short to the texture data and retrieve the value
at my single pixel location by indexing into the data [y*ySize+x]. I unpack
the components of the texel by masking and bitshifting each component:
ushort redValue = (data[y*ySize+x] & 0xf000) >> 12;
ushort greenValue = (data[y*ySize+x] & 0x0f00) >> 8;
ushort blueValue = (data[y*ySize+x] & 0x00f0) >> 4;
ushort alphaValue = data[y*ySize+x] & 0x000f;
Yet, when I inspect these values they are not correct.
The redValue appears correct, and, yet, if I write into this component it
appears in two locations in the texture map. This suggests that my concept
of the packing is way off. I'm obviously confused about how this works.
Would someone clue me in?
Thanks,
Alex Hill
ahill++at++evl.uic.edu
This archive was generated by hypermail 2b29 : Thu Aug 02 2001 - 07:50:36 PDT