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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to