Re: [osg-users] how to get the real world coordinates(x, y, z) in shader

2014-07-09 Thread Solkar Graphics
ttaw wrote: The world coord you mentioned is cooresponding to the earth view, but the world coord I calculate by osg::computeLocalToWorld function is not for earth view. osg::computeLocalToWorld is about ModelMatrices, not about ViewMatrices. ttaw wrote: For some purpose, I want these

Re: [osg-users] how to get the real world coordinates(x, y, z) in shader

2014-07-09 Thread Solkar Graphics
ttaw wrote: Sorry for my English.I meant that those two coords should be corresponding to a single coordinate system, either local coord system or world coord system or view coord system would be ok Which two vectors? In any case, given two vectors expressed in coords of different

Re: [osg-users] how to get the real world coordinates(x, y, z) in shader

2014-07-08 Thread Solkar Graphics
I received that my last msg of Tue Jul 08, 2014 2:09 was too large for the large mailing list to pass unmoderated, and indeed I would not not want to send mails with a 0.6M attachment. So @ttaw: the mentioned bugfix is an attachment of a post in the OSG forum. -- Read this

Re: [osg-users] how to get the real world coordinates(x, y, z) in shader

2014-07-08 Thread ttaw
Thank you, Solkar, you are so kind. I downloaded your code from osg forum, and ran the application. I found what really matters is the following two functions: setUseModelViewAndProjectionUniforms, setUseVertexAttributeAliasing, and osg_ModelViewMatrix in shader files.Am I right? But the

Re: [osg-users] how to get the real world coordinates(x, y, z) in shader

2014-07-08 Thread Solkar Graphics
ttaw wrote: But the problem still exists: [/quote] This [quote=ttawthe position coordinate of the text node remains mag x00[/quote] is not a problem. That is simply the world coordinate corresponding to the of the view the viewer creates for the perspective projection of the sphere.

Re: [osg-users] how to get the real world coordinates(x, y, z) in shader

2014-07-08 Thread ttaw
Hi, Solkar: The world coord you mentioned is cooresponding to the earth view, but the world coord I calculate by osg::computeLocalToWorld function is not for earth view.For some purpose, I want these two coords should be for a single view position. How can I do it? --

Re: [osg-users] how to get the real world coordinates(x, y, z) in shader

2014-07-06 Thread Solkar Graphics
Very well. Some preliminary remarks: The sphere Code: geode-addDrawable(new osg::ShapeDrawable(new osg::Sphere(osg::Vec3d(0,0,0), 650.0))); has a radius of 6.5E6, whereas your orthographic frustum Code: node-setProjectionMatrix(osg::Matrix::ortho2D(0, 1600, 0, 900)); is 3

Re: [osg-users] how to get the real world coordinates(x, y, z) in shader

2014-07-06 Thread ttaw
I tested my compiler(VisualStudio2010sp1), and found that c++11 is not supported unfortunately.It seems that ... is the problem.Following is the output info: VOODOO=1: 1InitializeBuildStatus: 1 Debug\test111.unsuccessfulbuild?? Touch ?? 1ClCompile: 1 1.cpp

Re: [osg-users] how to get the real world coordinates(x, y, z) in shader

2014-07-05 Thread Solkar Graphics
ttaw wrote: thanks.I see.I will post an attachment when i finish the sscce You got me wrong, no need anymore for you to provide code. I already fixed that little bug in your app, I just want to know if your compiler supports current C++ - it would be rather cynical to give you a bug fix you

Re: [osg-users] how to get the real world coordinates(x, y, z) in shader

2014-07-05 Thread ttaw
Really?I will have a test on your code when I'm ready next monday.Thank you so much:) -- Failure is the mother of success. Wu Zhicheng -- Original -- From: Solkar Graphics;sol...@freenet.de; Date: Sat, Jul 5, 2014 10:50 PM

Re: [osg-users] how to get the real world coordinates(x, y, z) in shader

2014-07-05 Thread Solkar Graphics
ttaw wrote: Really?I will have a test on your code when I'm ready next monday.Thank you so much:) You again got me wrong . The code I posted yet is not the bug fix itself, but just a test for C++11 support for your compiler. -- Read this topic online here:

Re: [osg-users] how to get the real world coordinates(x, y, z) in shader

2014-07-04 Thread Solkar Graphics
Hi, Well...I was more thinking about a SSCCE than a whole project, but anyway: Does your compiler support the currently effective (2011) standard for C++ sufficiently? try e.g. to compile this:

Re: [osg-users] how to get the real world coordinates(x, y, z) in shader

2014-07-03 Thread Solkar Graphics
ttaw wrote: No, the text node is parented to root,sibling with the earth node.I think if osg_ViewMatrixInverse is from eye position, the result could also be about -x00 because gl_ModelViewMatrix*vertex is between -1 and 1, after transforming to world coords, the value could be

Re: [osg-users] how to get the real world coordinates(x, y, z) in shader

2014-07-03 Thread ttaw
Hi, Solkar: My SSCCE is as the attachment.Run the application, and drag the earth and release, the earth would rotate, and you'll see a red block shows near the right side, which indicates the coordinates I got is less than -100.Thanks. -- Failure is the mother of

[osg-users] how to get the real world coordinates(x, y, z) in shader

2014-07-02 Thread ttaw
Hi,all: 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 which is in the scenegraph.It seems that the uniform osg_ViewMatrixInverse is not for the HUD

Re: [osg-users] how to get the real world coordinates(x, y, z) in shader

2014-07-02 Thread Solkar Graphics
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

Re: [osg-users] how to get the real world coordinates(x, y, z) in shader

2014-07-02 Thread ttaw
Hi, Solkar: Following is the symptoms: There's an earth node under scene root whose coordinates are between 500 and 700. 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

Re: [osg-users] how to get the real world coordinates(x, y, z) in shader

2014-07-02 Thread Solkar Graphics
ttaw wrote: Following is the symptoms: There's an earth node under scene root whose coordinates are between 500 and 700. 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

Re: [osg-users] how to get the real world coordinates(x, y, z) in shader

2014-07-02 Thread ttaw
No, the text node is parented to root,sibling with the earth node.I think if osg_ViewMatrixInverse is from eye position, the result could also be about -x00 because gl_ModelViewMatrix*vertex is between -1 and 1, after transforming to world coords, the value could be millions.