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

