Re: [osg-users] Change uniform array size
Hello. I try to create an algorithm which uses a configurable number of samples: uniform vec3 sample_kernel[256]; When i use value higher than 502, i get some errors which probably refer to my GPU (gtx 650). It seems gl_MaxFragmentUniformComponents is 2048. I try to use glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, value); but i dont get the correct value. In case I use a fixed size of samples and just pass as uniform the number of samplesi want to be checked, won't it affect the performance ? I mean having a large array of samples while i need the half. Thank you for your time. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Change uniform array size
Hi Peterakos, How you would tackle the problem depends upon what your need are for changing the number of uniforms. In terms of OpenGL objects it's generally best to used fixed size objects so that you don't have to reallocate them. To change the size used by the shader one would simply pass in second uniform to control how man samples are used. Robert. On 12 November 2012 19:36, Peterakos hay...@gmail.com wrote: Hello. Is there any way to change uniform array size ? What i do now is: const int num_of_samples = 64; uniform vec3 sample_kernel[num_of_samples]; Can i have num_of_samples as uniform ? If not, is it a good idea to have sample_kernel's size as 512 or 1024 and iterate only num_of_samples ? thank you. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org