To integrate the answer, I tried to use the osg::Real16 data type. It's
identical to OpenEXR half class (and has the same definitions) and it's
better supported in OpenSG of course. The bad side is that float 16 has a
considerable rounding error after the 2nd decimal digit. For example Float32
number 4.123000 is rounded to 4.121090. I will evaluate if it can be used to
make a texture coordinates file for a texture of 1024x1024 and let you know.
Erik

2009/1/19 Erik Podetti <[email protected]>

> Thanx. I'm trying to use the half class from OpenEXR. I'll let you know.
>
> Erik
>
> 2009/1/19 Shree Kumar <[email protected]>
>
> Hi Erik,
>>
>> On Mon, Jan 19, 2009 at 6:59 PM, Erik Podetti <[email protected]>
>> wrote:
>>
>> > But how can I write to a binary file 16-bit floating values? I read that
>> > there's an OpenGL extension that should add the "half" GL data type
>> > (
>> http://www.nvidia.com/dev_content/nvopenglspecs/GL_ARB_half_float_pixel.txt)...but<http://www.nvidia.com/dev_content/nvopenglspecs/GL_ARB_half_float_pixel.txt%29...but>
>> > I didn't succed in including it in any way. Anyone has already used this
>> or
>> > another type of variable to write float 16 values to a file?
>>
>> I'm not sure if OpenSG supports such file formats.
>>
>> If not, you could have a look at the "Half" class from
>> http://www.openexr.com/. OpenEXR has support for reading/writing
>> images with floating point data. The Half class in OpenEXR provides a
>> C++ class that you can use as easily as using "int" and "float".
>>
>> However, if all you want to do is save 16 bit floating point images,
>> then a quick way out is
>>   - do a ReadPixels to a buffer of the proper size (width*height*4*2
>> bytes for RGBA16F). Use format=GL_HALF_FLOAT_ARB and type=GL_RGBA
>>   - write all those bytes to the file
>>
>> To load the images
>>   - open the file, read in all the width*height*4*2 bytes
>>   - treat this buffer as the source for pixels - textures or images
>>
>> HTH
>> -- Shree
>> http://paracomp.sourceforge.net/
>> http://www.shreekumar.in/
>>
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by:
>> SourcForge Community
>> SourceForge wants to tell your story.
>> http://p.sf.net/sfu/sf-spreadtheword
>> _______________________________________________
>> Opensg-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/opensg-users
>>
>
>
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to