Hi Clement,

Take a look to example/osgtexture1D in OpenSceneGraph source.

Color are defined with 4 float value clamp between 0.0f and 1.0f.
then image are create with GL_RGBA for the pixel format and GL_FLOAT for
value type.
you can change the value type to
                   GL_BYTE
                   GL_UNSIGNED_BYTE
                   GL_SHORT
                   GL_UNSIGNED_SHORT
                   GL_INT
                   GL_UNSIGNED_INT
                   GL_UNSIGNED_SHORT_4_4_4_4
                   GL_UNSIGNED_INT_8_8_8_8
                    ...
So osg support 32 bit color/ 64 bit color / 128 bit color

Remember the main Rules   What your OpenGL implementation can does, OSG can
does.
OSG is a fine layer upon OpenGL, it simplify and automatise OpenGL
initialization/manipulation.

So to know pixel format and type supported by your hardware,
take a look to OpenGL specification (and optionaly OpenGL Extension) on
opengl.org <http://www.opengl.org/documentation/specs/>

HTH
David Callu


2011/8/31 <[email protected]>

> Hi Robert,
>
>  Does osg support 32 bit color and have up to 65536 colours?
>
>  I used TransferFunction1D because I will use the generated index to find
> out the colour later.  Would you give me an example how to simply create
> osg::image and assign to texture1d?  Thanks.
>
>
> Regards,
> Clement
>
> ________________________________________
> From: [email protected] [
> [email protected]] On Behalf Of Robert Osfield [
> [email protected]]
> Sent: Wednesday, 31 August 2011 5:45 PM
> To: OpenSceneGraph Users
> Subject: Re: [osg-users] Colour map
>
> Hi Clement,
>
> TransferFunction1D is really meant for making it easy to handle sparse
> data when setting up a 1D Texture for use as a colour look up on the
> GPU.
>
> For data where you are just encoding the colours directly in packed
> form then it would be more appropriate to simply create a osg::Image
> and assign this a Texture1D to use a colour look up table.
>
> Robert.
>
> On Wed, Aug 31, 2011 at 8:19 AM,  <[email protected]> wrote:
> > Anyone knows how many colour does osg support?  I would like to generate
> 65536 colour map by using the code below.  The size of the object colorMap
> is 65535.  Is it possible?  I am sure osg can support 8 bit colour, how
> about 32bit?  Thanks.
> >
> >        osg::TransferFunction1D::ColorMap colorMap;
> >
> >        double fcr = 255.0;
> >        int ri, gi, bi, ai, cc;
> >        int step = 16;
> >        int rgb_step = fcr /(step-1);
> >        int a_step = (fcr +1) / step;
> >
> >        cc = 0;
> >        colorMap[0] = osg::Vec4(0.0f, 0.0f, 0.0f, 0.0f);
> >        for (int r=0; r<step; r++) {
> >                ri = r*rgb_step;
> >                for (int g=0; g<step; g++) {
> >                        gi = g*rgb_step;
> >                        for (int b=0; b<step; b++) {
> >                                bi = b*rgb_step;
> >                                for (int a=1; a<=step; a++) {
> >                                        ai = min(a*a_step, fcr );
> >                                        cc++;
> >                                        colorMap[cc] = osg::Vec4(ri/fcr,
> gi/fcr, bi/fcr, ai/fcr);
> >                                }
> >                        }
> >                }
> >        }
> >        tf->assign(colorMap);
> >
> >
> > Regards,
> > Clement
> > _______________________________________________
> > 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
> _______________________________________________
> 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