Hi Sergey,

There one more point about available data size if you are using uniform arrays 
or uniform buffers:
you should pack your data into vec4's if it possible, cause uniforms counts towards max size with 
some kind of slots, with one slot taking storage size of vec4; if you declare your uniform as 
"uniform float[size] a;" it can takes "size" slots therefore wasting 3*size 
floats of memory, same with all types that less components than 4. Its ok with 4x4 matrices, and 
with 3x3 matrices you waste 3 floats per matrix. If you use uniform blocks - there are same thing 
to some extent, as data inside block is aligned and padded.

About texture buffers:
If you generate data for your instances on cpu side there are no point in using 
texture buffers actually. They pretty much same as 1D textures, except there 
are no filtering in them, they can fit more data and u access them in shaders 
with integer index (with texelFetch). They are useful if you generate data on 
gpu side with transform feedback, and you need more storage than uniform 
buffers. You still can use plain textures in latter case, just writing to your 
texture with fragment shaders instead of using transform feedback, tho this is 
a bit tricky.

Thanks for all the info, it's very useful. I'll probably use a texture to pass the data.

J-S
--
______________________________________________________
Jean-Sebastien Guay    [email protected]
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to