Re: [osg-users] OSG Uniform Array Setup [SEC=UNCLASSIFIED]

2010-07-27 Thread Henry Delattre
Hi Paul,

You should have a look at this thread, which explains the special case of 
arrays. You should find your solution.
http://forum.openscenegraph.org/viewtopic.php?t=5457

Thank you!

Cheers,
Henry

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] OSG Uniform Array Setup [SEC=UNCLASSIFIED]

2010-07-26 Thread Paul Pocock
Hi All,

I've been trying out geometry instancing however am experiencing OpenGL
errors. I'm using NV 8800GTX with
latest 256.35 Linux drivers so it should work. I am thinking it is my
set up. I have set up everything correctly
as per osgdrawinstanced example so i'm thinking it is the way I'm
passing the uniform to the shader? maybe the
use of Vec4Array? If someone could pass a casual eye over the relevant
code below and see something noticeable
 I would be grateful.

I was also wondering if it is a driver bug - if there are alternate
solutions to pass array data to
the vertex shader? - Regards

//Set up


osg::ref_ptrosg::Vec4Array m_positions = new osg::Vec4Array;

// Fill up the Array etc ... size: 10
//v-push_back(osg::Vec4(position,1.0));

osg::Uniform* centres = new osg::Uniform( centres, m_positions );
osg::Uniform* centres = new osg::Uniform();
centres-setName(centres);
centres-setType(osg::Uniform::FLOAT_VEC4);
centres-setNumElements(m_positions-size());

stateset-addUniform(centres);



  //Vertex shader

uniform vec4[10] centres;




vec3 centre = centres[gl_InstanceID].xyz;

vec3 pos = gl_Vertex + centre;

gl_Position = gl_ModelViewProjectionMatrix * vec4(pos,1.0);

IMPORTANT: This email remains the property of the Department of Defence and is 
subject to the jurisdiction of section 70 of the Crimes Act 1914. If you have 
received this email in error, you are requested to contact the sender and 
delete the email.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org