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_ptr<osg::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
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to