Hi, Solkar:
   Following is the symptoms: There's an earth node under scene root whose 
coordinates are between 5000000 and 7000000. And also an ortho-projecting HUD 
camera with width 1600 and height 900 is under root.Under the HUD camera, a 
geode with text whose position is (1300,500,0) and whose size is (200,75) 
exists.Eye position is above the earth surface. The x coords of the geode I got 
by osg_viewMatrixInverse*gl_ModelViewMatrix*vertex is less than -1000000.But 
the value I want is (1300,500,0). 
  
  ------------------
  Failure is the mother of success.
 Wu Zhicheng


  
  

 

 ------------------ Original ------------------
  From:  "Solkar Graphics";<[email protected]>;
 Date:  Thu, Jul 3, 2014 00:45 AM
 To:  "osg-users"<[email protected]>; 
 
 Subject:  Re: [osg-users] how to get the real world coordinates(x, y,z) in 
shader

 


ttaw wrote:
> I want to get world coordinates of vertices in shader. I used:
> osg_ViewMatrixInverse*(gl_ModelViewMatrix*vertex);
> But the result is wrong if the geode is a child of an HUD camera node 
 (emphasis mine)
What are the symptoms?


ttaw wrote:
> which is in the scenegraph.It seems that the uniform osg_ViewMatrixInverse is 
> not for the HUD camera.

If this is that fact, you could create a custom mat4 in the shader and provide 
the inverse ViewMatrix to it via an  osg::Uniform.


Best regards,
S.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=60113#60113





_______________________________________________
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

Reply via email to