TracNav
Home
Getting Started
Help
Community
Development
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:
#!cpp
#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();
beginEditCP(tex);
tex->setImage(img);
tex->setMinFilter(GL_NEAREST);
tex->setMagFilter(GL_NEAREST);
tex->setWrapS(GL_CLAMP_TO_EDGE);
tex->setWrapT(GL_CLAMP_TO_EDGE);
tex->setInternalFormat(GL_RGBA32F_ARB); // Tell it to use the full 32 bit internally
endEditCP(tex);
Submitted by Dirk Reiners, 2006/10/05.
Comments
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
