Hi,
I would send parameters to my shaders using a structure, for example :
Code:
struct LightParameters
{
vec4 position;
int type;
vec4 color;
float someParameter;
float someMoreParameter;
...
}
So I'm having a look at Uniform blocks and Uniform Buffer Object...
I've read this post : http://forum.openscenegraph.org/viewtopic.php?t=6775 and
I've try the "osguniformbuffer" example, but I have some questions :
In the "osguniformbuffer", the block size is set to :
Code:
const unsigned blockSize = 20 * sizeof(GLfloat);
but in the GLSL code, the block is :
Code:
layout(std140) uniform colors0
{
float DiffuseCool;
float DiffuseWarm;
vec3 SurfaceColor;
vec3 WarmColor;
vec3 CoolColor;
};
So I don't understand the "20 * sizeof(GLfloat)" in the computation of the
block size.
How can I bind a C++ structure which mix vec4, float, int and other types to
the Uniform Buffer Object ?
Thank you!
Cheers,
Aurelien[/code]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=44688#44688
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org