Re: How are 565 textures generated?
Allen Akin <[email protected]> Wed, 25 Jan 2006 12:32:23 -0800
| Newsgroups | gmane.games.devel.opengl |
|---|---|
| Organization | Fat City Network Services, San Diego, California |
| Message-ID | <[email protected]> |
Hi, Steve! On Wed, Jan 25, 2006 at 11:22:23AM -0800, Stephen J Baker wrote: | If I create a texture with an external format that is 8+8+8 bit RGB, | and an internal format of 5+6+5 RGB, how is the data converted by | glTexImage2D ? I believe the relevant parts of the spec (v2.0) are table 2.9 for the conversion from fixed to float and section 2.4.19 for conversion from float to fixed. In this case the 8-bit values are mapped into the range [0.0, 1.0] by dividing by 255. Then the individual color channels are multiplied by 31 (R and B) or by 63 (G), and the results rounded to nearest. I would bet that all the commercial implementations replace the conceptual floating-point arithmetic with fast fixed-point arithmetic that yields the same results. | It *looks* like (at least on nVidia 6800 on their latest Linux drivers) | they are doing something other than just truncating the LSbits. Sounds like they're probably doing the right thing. | It seems that if the driver rounded the data then there would be a problem | with numbers like 0xFF being rounded up to 0x100 and overflowing. That's | what made me assume they'd be truncating it. The math is supposed to be done so that the highest value in any fixed-point representation maps to the highest value in all other fixed-point representations. Some values less than the highest value in one representation might also be rounded up to the highest value in another representation, but there should never be any overflow. | I also wonder what (if any) things are done to keep the extra bit of | green precision from generating magenta/green tints to otherwise grey | areas of the image. Nothing that I know of. Allen ----- FAQ and OpenGL Resources at: http://www.geocities.com/SiliconValley/Hills/9956/OpenGL -- Author: Allen Akin INET: [email protected] Fat City Hosting, San Diego, California -- http://www.fatcity.com --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [email protected] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).