Hi all. First of all, sorry if mine is a silly question, I'm quite new to using shaders in OSG.
My scenario is this: I have a vertex shader that gets as uniform in-variable the model view projection matrix, "MVP_matrix" is the name of that variable in my shader. The shader is written in GL4.3, so I cannot rely upon the deprecated built-in variable gl_ModelViewProjection matrix. Now, I have to attach such shader in a program that is set in a state set used to render my geometry (that state set is attached to the geode that contains my drawable, where the geometry is defined). So, I would like that OSG automatically passes the model view projection matrix to my shader during rendering traversal. I've seen in some OSG code that there is a predefined in-variable called "osg_ModelViewProjectionMatrix" that I think is filled by OSG during rendering traversal with the current model view projection matrix. Is that correct? So, should I rely upon it in my shader, basically replacing my "MVP_matrix" with "osg_ModelViewProjectionMatrix"? Further question: unfortunately the shader I have to use is shared among other applications in my company, and not all of them use OSG for rendering (some use pure OpenGL) :( So it's likely that I cannot modify it (otherwise I should ask all developers to change the name of the in-variable they pass directly to the shader to "osg_ModelViewProjectionMatrix"). Hence the question: if I'm forced to use "MVP_matrix", is there a way I can tell OSG to set automatically the value of "osg_ModelViewProjectionMatrix" to "MVP_matrix" at run-time, i.e. during rendering traversal? Thanks, Gianluca
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

