Hi Laith, OSG defines the osg_ViewMatrixInverse uniform. You have to add
uniform mat4 osg_ViewMatrixInverse; in your shader to use it and find the camera location in world coordinates. Otherwise, there is the gl_ModelViewMatrixInverse uniform if you want to transform the camera position from eye coordinates (0,0,0) into local object coordinates. Regards, -Fred ----- "Robert Osfield" <[email protected]> a écrit : > Hi Laith, > > In OpenGL the camera position is always at 0,0,0, and the scene is > transformed into cameras coordinates by the modelview matrix. > > So... one has to ask are you wanting to do calculations in the > eye/camera coordinates, world coordinates or local object > coordinates? > You can transform the camera position into world or local object > coordinates by multipling by the inverse of the view or modelview > matrices respectively. > > Robert. > > On Thu, Jan 13, 2011 at 6:34 AM, Laith Dhawahir > <[email protected]> wrote: > > Heey Guys, > > I hope you will fine, > > anyway, i have question about how i can get the camera position > inside shader from open scene graph do i must pass it, or open scene > graph already do that. > > > > Thank you! > > > > Cheers, > > Laith > > > > ------------------ > > Read this topic online here: > > http://forum.openscenegraph.org/viewtopic.php?p=35600#35600 > > > > > > > > > > > > _______________________________________________ > > 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 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

