Hi Adrien,

The way to do colour look up tables in OpenGL these days is to use a
fragment program that reads the source texture which is an 8bit
intensity/alpha texture and then look this up a second texture.  So
create the two osg::Image, one for the 8bit data, and then a second
one for the RGBA look up table.  Assign these two osg::Image to
Texture2D and an Texture1D respectively.

The is an osg::TransferFunction1D class for helping create RGBA look
up tables, this is used in osgVolume so you could look at this as an
example.

Robert.

On Tue, Jun 29, 2010 at 7:02 PM, Adrien Chassard <[email protected]> wrote:
> Hi,
>
> I try to load a 8bits image and create an osg::Texture2D with it. I search 
> all the day but without sucess.
>
> It seems that the image load by osgDB::readImageFile(...) is transform in a 
> 32 bits image. Is it possible to load it as 8bits image with an associated 
> look up table ? (I didn't find attribut in osg::Image that could correspond 
> to a lut, is there one ?)
>
> However if I can load my image as a 8 bits image, I don't know how I can 
> associate the color table to the texture, is there a way to do that ?
>
> In fact and to clarify what I mean, here is the code in OpenGL I would like 
> to translate in OpenSceneGraph :
>
> glColorTableEXT(GL_TEXTURE_2D, GL_RGBA8, 256, GL_RGBA, GL_UNSIGNED_BYTE, 
> colorTable);
> glTexImage2D(GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, width, height, 0, 
> GL_COLOR_INDEX, GL_UNSIGNED_BYTE, texture);
>
> I hope I was enough clear. Sorry if I wasn't.
>
> Thank you very much for your help.
>
> Cheers,
> Adrien
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=29500#29500
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to