From: Marcin Romaszewicz (marcin++at++asmodean.engr.sgi.com)
Date: 08/03/2001 19:31:52
You need to do your bit operations on the texture data based on the
external format, not the internal format. The internal format is how the
hardware stores your texture and it is often different than the intenral
format in memory. OpenGL will do the external->internal conversion.
-- Marcin
On Thu, 2 Aug 2001, Alex Hill wrote:
> 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
>
>
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> Open Development Project: http://oss.sgi.com/projects/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
>
This archive was generated by hypermail 2b29 : Fri Aug 03 2001 - 19:31:55 PDT