30 Jun 2012 09:02
Problems using shader attributes
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(Continue reading)
RSS Feed