Hi Preet, The OSG provides more than just support for passing data to OpenGL, it does culling and this requires knowledge of the bounding volume of the object. I would recommend sticking with using the standard osg::Geometry::setVertexArray(..) for passing in the vertex positions of your data so that the OSG can compute the bounding volumes automatically for you.
Robert. On 30 June 2012 08:02, Preet <[email protected]> wrote: > Hiya. > > I'm trying to pass attributes to my vertex shader, but have come > across several issues.These issues only occur when I use OSG -- if I > try to do the same thing with straight OpenGL calls, it works fine. > I've set "setUseModelViewAndProjectionUniforms(true)" and > "setUseVertexAttributeAliasing(false)". I add vertex attributes to my > geometry by calling "setVertexAttribArray". I don't explicitly specify > any other arrays (I don't call "setVertexArray" or anything like > that). > > * Assigning a position attribute to '0' works as expected and my > geometry shows up. Moving that position attribute to another slot > doesn't work. I explicitly call "setCullingActive(false)" on my > geometry and set zNear zFar on my camera but when I try to render the > scene I get what I think are scene culling related issues: > > cull_draw() 0x15cd420 > _clampProjectionMatrix not applied, invalid depth range, znear = > 3.40282e+38 zfar = -3.40282e+38 > end cull_draw() 0x15cd420 > > > * I also tried playing around with a normal attribute. I just take the > normal and pass it as a varying to the fragment shader where it > directly sets the fragment color to the value of the normal. I get a > sane result when I set the normal attribute to slot 1,2 or 6 or 7. If > I set the normal attribute slot to anything else I get random gray > shapes obscuring the viewport: > > normal attribute set to slot 1: http://i.imgur.com/C5MQ7.png > normal attribute set to slot 4: http://i.imgur.com/5tGoS.png > same scene in app that uses straight opengl calls: > http://i.imgur.com/C5MQ7.png (note that the normal values are > different as well, I don't know why this is as I pass in the same > values to both) > > So, does anyone know what's going on? Why can I arbitrarily set > attributes to whatever slots I want in my 'raw' OpenGL program, but > not with OpenSceneGraph? > > > I'm using OpenSceneGraph 3.0.1 with an Nvidia card that supports > OpenGL 4.2 on Linux. > > > Preet > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

