Floating-point textures are supported on most graphics cards these days, and they are useful for a wide variety of algorithms. But the OpenSG Image doesn't seem to have direct support for them, and even if you managed to create a floating point image, it's not necessarily reflected in the actual texture data used inside OpenGL.

This is how to create a full floating point texture:


#include <OpenSG/OSGGLEXT.h>

#include <OpenSG/OSGImage.h>

Real32 imgdata[] = {  4,0,0,  0,3,0,  0,0,4, 2,2,0 };

ImagePtr img = Image::create();

img->set(Image::OSG_RGB_PF, 2, 2, 1, 1, 1, 0, 

                (UInt8*)imgdata, // cast to avoid compiler problems

                Image::OSG_FLOAT32_IMAGEDATA); // Give the right internal format

TextureChunkPtr tex = TextureChunk::create();







    tex->setInternalFormat(GL_RGBA32F_ARB); // Tell it to use the full 32 bit internally


Submitted by Dirk Reiners, 2006/10/05.


Are there any standard file formats supporting raw float data that OpenSG could/should be extended to support? -AB

I think .dds supports them, and we have support for that. OpenEXR is another one that needs an external lib, but we have code for that. HDR would be useful, as it used on the rendering side quite a bit. Don't know about others. --DR

Last modified 7 years ago Last modified on 01/17/10 01:11:44