Hi Josselin,

as J.P. already said, I think your problem is that single precision float 
values are not enough to be precise for the tenth number behind the comma. 
There is no OpenGL texture format which can support double textures. There 
exists only 32bit single precision float format. Maybe some of the vendor 
OpenGL extensions do support such texture, but I think no.

CUDA does support native double values, however only if you GPU does also 
support them, so having CUDAs computing capability of at least 1.3, I think. 
Currently this works only on G200 GPUs. 

So, if you wish to work with OpenGL, then think on the way how either to:
 - overcome your precision problem (i.e. move the comma to the right): very 
easy to implement, however precision get lost when having large numbers before 
comma
- analyze your algorithm and maybe start to use 32bit integers (very common in 
µC programming), because they can represent any value between -2^16 to 2^16, so 
you have at least 9 numbers for your precision): I agree that using integers 
instead of floats in a GLSL shader is somehow a big misuse and might not work, 
but why not ;)
- or pack your doubles in two floats and think on how to use the packed values 
in your computations

Cheers,
art

P.S. In a lot of cases researches complain that they have not enough precision. 
However in most such cases the precision problem can be solved by analyzing and 
changing the algorithm to use the given hardware setup in more efficient way.


josselin wrote:
> Hi everyone,
> 
> I would like to use osg PPU to compute very accurate data, about ten  
> number behind the comma, to avoid numerical errors.
> 
> So I used 32 bits textures for the render to texture :
> texture2D->setInternalFormat(GL_RGBA32F_ARB);
> texture2D->setSourceFormat(GL_RGBA);
> texture2D->setSourceType(GL_FLOAT);
>                       
> texture2D->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_BORDER);
> texture2D->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_BORDER);
> texture2D->setWrap(osg::Texture2D::WRAP_R,osg::Texture2D::CLAMP_TO_BORDER);
> texture2D->setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::NEAREST);
> texture2D->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST);
> 
> 
> But I noticed, by exemple, when I put the value 0.012024048 in one  
> shader (gl_FragColor = vec(0.012024048, 0.012024048, 0.012024048,  
> 1.0);),
> the value read in the next shader becomes 0.012023926.
> I checked the values twice, once with the glsl Devil debugger, once  
> with an UnitOutCapture.
> 
> Is there a way to have more precision for my data ?
> 
> Thanks in advance,
> Josselin.
> 


------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=17422#17422





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to