Hi, Felix I dont know for sure what matrix get returned from state, but if you get view\projection matrix from camera (or , for projection matrix - from osg::Projection) - it works perfectly fine, at least for me.
Cheers, Sergey. 11.08.2012, 02:52, "Felix Meißgeier" <[email protected]>: > Hey, > > i've got a problem passing modelview-matrix as uniform to a vertexshader. I > want to realize a object-motion-blur-effect and so I need the > previous-mv-matrix. More precisely I guess (not to say I'm sure) that my > passed matrix doesn't work. I read about some difference between the > orientations of the opengl- and osg-coordinate system. Could this be a > reason, why the fixed-builtin-uniforms gl_ProjectionMatrix, > gl_ModelViewMatrix,... work perfectly and my matrix doesn't?? > For testing purpose I created a simple shader which bypasses the clipcoords > of a vertex to fragmentshader (gl_Position) and sets gl_FragColor to white > (using my own projection-matrix). The computation "gl_Position = > gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex" worked fine, but > "gl_Position = myownprojmat * gl_ModelViewMatrix * gl_Vertex" failed. I tried > different ways to generate the proj-matrix. I got it from my (pre-render-) > camera which is the parent of my scene-root and I tried > > Code: > > osgViewer::Viewer::Contexts contexts; > _viewer->getContexts(contexts); > pmatrix=contexts[0]->getState()->getProjectionMatrix(); > > During my tests passing the modelview-matrix I used the view-matrix of the > parental-camera and the computelocaltoworld(osg::Nodepath)-function... > > Maybe anybody has an idea where I've got the mistake or has a tip how to > implement this. > > Thank you! > > Cheers, > Felix > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=49235#49235 > > _______________________________________________ > 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

