[osg-users] default coordinate system and camera - newbie

2009-04-02 Thread ami guru
Hello Paul,


I have made the following changes, still having the same value:


***
int main()
{
//Creating the viewer
osgViewer::Viewer viewer ;


*viewer.setCameraManipulator(new osgGA::TrackballManipulator());*


//add some event handler
//to show the statistics
viewer.addEventHandler(new osgViewer::StatsHandler);


/*
  get camera related information

 */
osg::Vec3f eye;
osg::Vec3f dir;
osg::Vec3f up;

viewer.getCamera()-getViewMatrixAsLookAt(eye,dir,up);


cout  The eye  vector:   eye.x() eye.y()
eye.z()  endl;
cout  The look at position:   dir.x() dir.y()
dir.z()  endl;
cout  The up vector is:   up.x() up.y() up.z()
 endl;



***

-- Forwarded message --
From: ami guru dosto.wa...@gmail.com
Date: Thu, Apr 2, 2009 at 2:39 AM
Subject: Fwd: [osg-users] default coordinate system and camera - newbie
To: OpenSceneGraph Users osg-users@lists.openscenegraph.org


Hello Paul,


I have the following snippet that deals with the viewer


**'
int main()
{
//Creating the viewer
osgViewer::Viewer viewer ;


//add some event handler
//to show the statistics
viewer.addEventHandler(new osgViewer::StatsHandler);


/*
  get camera related information

 */
osg::Vec3f eye;
osg::Vec3f dir;
osg::Vec3f up;

viewer.getCamera()-getViewMatrixAsLookAt(eye,dir,up);


cout  The eye  vector:   eye.x() eye.y()
eye.z()  endl;
cout  The look at position:   dir.x() dir.y()
dir.z()  endl;
cout  The up vector is:   up.x() up.y() up.z()
 endl;

//Creating the root node
osg::ref_ptrosg::Node root  = createSceneGraph();





'**


Could you provide some hint where the bug might be , at least  the way to
find it?


I want to implement a very simple scenario. A camera that moves along with
the key press event.

I already have that implemented in OpenGL program where i can roll, pitch
yaw and slide with user key press event.


I want to map that in the scene graph system.


I have the following information predefined

*n* = eye - look;
*u* = *up* * *n*;
*v* = *n* * *u*;


To move the camera in an ineractive way i have to have the access to there
values .


there is a function in the Camera Class called getViewMatrix() , i hope that
it is one to access these values.


Any more reference would be of great help.


-- Forwarded message --
From: Paul Martz pma...@skew-matrix.com
Date: 2009/4/2
Subject: Re: [osg-users] default coordinate system and camera - newbie
To: OpenSceneGraph Users osg-users@lists.openscenegraph.org


 The CameraManipulator (like TrackballManipulator, for example) determines
the default orientation. You can change this default by setting the up
vector in the TrackballManipulator. By default, the TrackballManipulator
uses positive Z up, so if your code is getting positive Y up, either you
have a bug or you are not using the TrackballManipulator or you have changed
its default.

The default view position is also determined by the CameraManipulator. The
TrackballManipulator, for example, has a home position that you can set. By
default, it considers the scene bounding volume and tries to position the
view so that the entire scene fits within a 50 degree FOV (I think it's 50,
not sure).

Paul Martz
*Skew Matrix Software LLC*
http://www.skew-matrix.com
+1 303 859 9466


 --
*From:* osg-users-boun...@lists.openscenegraph.org [mailto:
osg-users-boun...@lists.openscenegraph.org] *On Behalf Of *ami guru
*Sent:* Wednesday, April 01, 2009 1:58 PM
*To:* OpenSceneGraph Users
*Subject:* [osg-users] default coordinate system and camera - newbie

Hello forum,


osgViewer , by default uses the world coordinate system that is oriented
with positive X to right , positive Z up, and positive Y into the screen.


Does that mean  the camera' s defualt position is at the origin looking down
into  the screen which is positive Y?


I have tried to extract  the vectors using the function

'
osg::Vec3f eye;
osg::Vec3f dir;
osg::Vec3f up;

viewer.getCamera()-getViewMatrixAsLookAt(eye,dir,up);


cout  The eye  vector:   eye.x() eye.y()
eye.z()  endl;
cout  The look at position:   dir.x() dir.y()
dir.z()  endl;
cout  The up vector is:   up.x() up.y() up.z()
 endl;





The eye  vector: 0 0 0
The look at position: 0 0 -1
The up vector is: 0 1 0


I was wondering if the up vector be Z axis instead


Regards
Sajjad


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg

Re: [osg-users] default coordinate system and camera - newbie

2009-04-02 Thread Paul Martz
My guess is that, at the time you do the query, you haven't rendered a frame
yet. If so, the Viewer object hasn't queried the manipulator matrix yet. You
have the source code, so you can easily verify this with a debugger.
 
Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com http://www.skew-matrix.com/ 
+1 303 859 9466
 

  _  

From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of ami guru
Sent: Thursday, April 02, 2009 8:05 AM
To: OpenSceneGraph Users
Subject: [osg-users] default coordinate system and camera - newbie


Hello Paul,


I have made the following changes, still having the same value:


***
int main()
{
//Creating the viewer
osgViewer::Viewer viewer ;


viewer.setCameraManipulator(new osgGA::TrackballManipulator());


//add some event handler
//to show the statistics
viewer.addEventHandler(new osgViewer::StatsHandler);


/*
  get camera related information

 */
osg::Vec3f eye;
osg::Vec3f dir;
osg::Vec3f up;

viewer.getCamera()-getViewMatrixAsLookAt(eye,dir,up);


cout  The eye  vector:   eye.x() eye.y()
eye.z()  endl;
cout  The look at position:   dir.x() dir.y()
dir.z()  endl;
cout  The up vector is:   up.x() up.y() up.z()
 endl;



***


-- Forwarded message --
From: ami guru dosto.wa...@gmail.com
Date: Thu, Apr 2, 2009 at 2:39 AM
Subject: Fwd: [osg-users] default coordinate system and camera - newbie
To: OpenSceneGraph Users osg-users@lists.openscenegraph.org


Hello Paul,


I have the following snippet that deals with the viewer


**'
int main()
{
//Creating the viewer
osgViewer::Viewer viewer ;


//add some event handler
//to show the statistics
viewer.addEventHandler(new osgViewer::StatsHandler);


/*
  get camera related information

 */ 

osg::Vec3f eye;
osg::Vec3f dir;
osg::Vec3f up;

viewer.getCamera()-getViewMatrixAsLookAt(eye,dir,up);


cout  The eye  vector:   eye.x() eye.y()
eye.z()  endl;
cout  The look at position:   dir.x() dir.y()
dir.z()  endl;
cout  The up vector is:   up.x() up.y() up.z()
 endl;


//Creating the root node
osg::ref_ptrosg::Node root  = createSceneGraph();





'**


Could you provide some hint where the bug might be , at least  the way to
find it?


I want to implement a very simple scenario. A camera that moves along with
the key press event.

I already have that implemented in OpenGL program where i can roll, pitch
yaw and slide with user key press event.


I want to map that in the scene graph system.


I have the following information predefined

n = eye - look;
u = up * n;
v = n * u;


To move the camera in an ineractive way i have to have the access to there
values .


there is a function in the Camera Class called getViewMatrix() , i hope that
it is one to access these values.


Any more reference would be of great help.



-- Forwarded message --
From: Paul Martz pma...@skew-matrix.com
Date: 2009/4/2
Subject: Re: [osg-users] default coordinate system and camera - newbie
To: OpenSceneGraph Users osg-users@lists.openscenegraph.org



The CameraManipulator (like TrackballManipulator, for example) determines
the default orientation. You can change this default by setting the up
vector in the TrackballManipulator. By default, the TrackballManipulator
uses positive Z up, so if your code is getting positive Y up, either you
have a bug or you are not using the TrackballManipulator or you have changed
its default.
 
The default view position is also determined by the CameraManipulator. The
TrackballManipulator, for example, has a home position that you can set. By
default, it considers the scene bounding volume and tries to position the
view so that the entire scene fits within a 50 degree FOV (I think it's 50,
not sure).
 
Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com http://www.skew-matrix.com/ 
+1 303 859 9466
 

  _  

From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of ami guru
Sent: Wednesday, April 01, 2009 1:58 PM
To: OpenSceneGraph Users
Subject: [osg-users] default coordinate system and camera - newbie


Hello forum,


osgViewer , by default uses the world coordinate system that is oriented
with positive X to right , positive Z up, and positive Y into the screen.


Does that mean  the camera' s defualt position is at the origin looking down
into  the screen which is positive Y?


I have tried to extract  the vectors using the function 

'
osg::Vec3f eye;
osg::Vec3f dir;
osg::Vec3f up

[osg-users] default coordinate system and camera - newbie

2009-04-01 Thread ami guru
Hello forum,


osgViewer , by default uses the world coordinate system that is oriented
with positive X to right , positive Z up, and positive Y into the screen.


Does that mean  the camera' s defualt position is at the origin looking down
into  the screen which is positive Y?


I have tried to extract  the vectors using the function

'
osg::Vec3f eye;
osg::Vec3f dir;
osg::Vec3f up;

viewer.getCamera()-getViewMatrixAsLookAt(eye,dir,up);


cout  The eye  vector:   eye.x() eye.y()
eye.z()  endl;
cout  The look at position:   dir.x() dir.y()
dir.z()  endl;
cout  The up vector is:   up.x() up.y() up.z()
 endl;





The eye  vector: 0 0 0
The look at position: 0 0 -1
The up vector is: 0 1 0


I was wondering if the up vector be Z axis instead


Regards
Sajjad
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] default coordinate system and camera - newbie

2009-04-01 Thread Paul Martz
The CameraManipulator (like TrackballManipulator, for example) determines
the default orientation. You can change this default by setting the up
vector in the TrackballManipulator. By default, the TrackballManipulator
uses positive Z up, so if your code is getting positive Y up, either you
have a bug or you are not using the TrackballManipulator or you have changed
its default.
 
The default view position is also determined by the CameraManipulator. The
TrackballManipulator, for example, has a home position that you can set. By
default, it considers the scene bounding volume and tries to position the
view so that the entire scene fits within a 50 degree FOV (I think it's 50,
not sure).
 
Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com http://www.skew-matrix.com/ 
+1 303 859 9466
 

  _  

From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of ami guru
Sent: Wednesday, April 01, 2009 1:58 PM
To: OpenSceneGraph Users
Subject: [osg-users] default coordinate system and camera - newbie


Hello forum,


osgViewer , by default uses the world coordinate system that is oriented
with positive X to right , positive Z up, and positive Y into the screen.


Does that mean  the camera' s defualt position is at the origin looking down
into  the screen which is positive Y?


I have tried to extract  the vectors using the function 

'
osg::Vec3f eye;
osg::Vec3f dir;
osg::Vec3f up;

viewer.getCamera()-getViewMatrixAsLookAt(eye,dir,up);


cout  The eye  vector:   eye.x() eye.y()
eye.z()  endl;
cout  The look at position:   dir.x() dir.y()
dir.z()  endl;
cout  The up vector is:   up.x() up.y() up.z()
 endl;





The eye  vector: 0 0 0
The look at position: 0 0 -1
The up vector is: 0 1 0


I was wondering if the up vector be Z axis instead


Regards
Sajjad


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org