C++ cant find a match for 16 bit float and how to convert 32 bit float to 16 bit one

Started by
11 comments, last by alh420 9 years, 1 month ago

I use a branchless table-driven implementation by Jeroen van der Zijp (http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf) which some time ago I wrapped into a class to make it as convenient as a regular float.

The conversions in both directions are two-liners, and the combined size of all of the lookup tables is less than 10K.

http://homepages.vodafone.co.nz/~tawa47a/Malc/Useful_Classes.htm

It's probably nearly functionally identical to Aressera's

Edit: Bah, Jeroen van der Zijp's original link is now not working for me.

Edit2: Christian Rau has since produced an even more complete version here, which is clearly also based on Jeroen's work, but is more complete than mine, with template meta-programming to avoid unnecessary conversions and such:

http://half.sourceforge.net/

Probably best just to use that one.

"In order to understand recursion, you must first understand recursion."
My website dedicated to sorting algorithms
Advertisement

i just wonder how opengl can know that i input float i know that i can deifine that i want to convert my input to half floats but how do opengl knows that i put there floats not bytes or whatever that is and iterates through array properly


i just wonder how opengl can know that i input float i know that i can deifine that i want to convert my input to half floats but how do opengl knows that i put there floats not bytes or whatever that is and iterates through array properly

It knows because you tell it, through the "type" argument to glTexImage. (make sure you don't lie to it ;) )

This topic is closed to new replies.

Advertisement