Thanks Jason, I may do some testing with floats to see if they work out, but most likely I'll play it safe and use unsigned ints for r,g,and b and come up with an indexing scheme that can theoretically host up to 16.7 million discrete values.
Jason Daly wrote: > On 03/05/2012 10:54 AM, Ethan Fahy wrote: > > > If I were to set the color of a vertex of an osg::Node using floats between > > 0-1 and then accessed the color of that same vertex in a GLSL shader, would > > I get back the exact same floating point value? I am worried that at some > > point in the pipeline that float would be scaled to an 8 bit unsigned int > > between 0-255 and then rescaled back to a 0-1 float when accessed using > > GLSL. The reason I ask is that I am hoping to use the floating point value > > to carry a scaled index number for a lookup table in the shader instead of > > a color, so precision would be important. > > > > Hi, Ethan, > > If you're talking about vertex attribute data, you're likely get the > same value back that you originally specified. The vertex attributes > will remain in float form until you actually rasterize the vertices. > Only at that point will they need to be converted to fit the data format > of the framebuffer. > > That said, it's generally not a good idea to rely on floating point > values to be exactly the same from one call to the next. I'd recommend > trying to come up with a different way to do what you're attempting, or > at least use an epsilon value in your comparison. > > --"J" > > _______________________________________________ > osg-users mailing list > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > ------------------ > Post generated by Mail2Forum ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=46039#46039 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

