[osg-users] How to draw a simple frustum wireframe cube?

2012-09-17 Thread Charma Man
Hello Forum,

I am an absolute osg-beginner. I am currently working on a very huge project 
which is using osg. I now would like to draw something in the existing scene 
without messing everything up. I will try to give you as much detail as I can 
to make it easier to understand.

I have access to a callback-function which is called before every frame 
drawing. Also I have access to the two matices


Code:
this-rootTransform = opencover::cover-getObjectsXform()-getMatrix();

// Get camera frustum parameters
osg::Matrix matProj = 
opencover::coVRConfig::instance()-screens[0].camera-getProjectionMatrix();

matProj.getFrustum(
this-frustum.left,
this-frustum.right,
this-frustum.bottom,
this-frustum.top,
this-frustum.znear,
this-frustum.zfar
);




As you probably see the call opencover::coVRConfig::instance() also returns the 
instance. What I would like to do now is draw some simple lines (as in like 
glBegin) but in screen coordinates, so with positions in the frustum corners 
like (1,1,1) or (1,-1,-1).

The reason for this is that I want to make the whole frustum visible because 
I am using a stereoscopic VR-renderer and I want to validiate how big the 
frustum is and when do you step into the 3D scene.

I hope anyone can help me with this and can provide some simple sample code. If 
you need more detail, feel free to ask back.

Thank you!

Cheers,
Charma

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





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


Re: [osg-users] How to draw a simple frustum wireframe cube?

2012-09-17 Thread Robert Osfield
Hi Charama??

Perhaps the osgthirdpersonview example
(OpenSceneGraph/examples/osgthirdpersonview/osgthirdpersonview.cpp)
would be appropriate as this creates a third personal view of the main
interactive view with the third person view showing the view frustum
on the main view as a wireframe.

Robert.



On 14 September 2012 10:36, Charma Man motoko_kusan...@web.de wrote:
 Hello Forum,

 I am an absolute osg-beginner. I am currently working on a very huge project 
 which is using osg. I now would like to draw something in the existing scene 
 without messing everything up. I will try to give you as much detail as I can 
 to make it easier to understand.

 I have access to a callback-function which is called before every frame 
 drawing. Also I have access to the two matices


 Code:
 this-rootTransform = opencover::cover-getObjectsXform()-getMatrix();

 // Get camera frustum parameters
 osg::Matrix matProj = 
 opencover::coVRConfig::instance()-screens[0].camera-getProjectionMatrix();

 matProj.getFrustum(
 this-frustum.left,
 this-frustum.right,
 this-frustum.bottom,
 this-frustum.top,
 this-frustum.znear,
 this-frustum.zfar
 );




 As you probably see the call opencover::coVRConfig::instance() also returns 
 the instance. What I would like to do now is draw some simple lines (as in 
 like glBegin) but in screen coordinates, so with positions in the frustum 
 corners like (1,1,1) or (1,-1,-1).

 The reason for this is that I want to make the whole frustum visible 
 because I am using a stereoscopic VR-renderer and I want to validiate how big 
 the frustum is and when do you step into the 3D scene.

 I hope anyone can help me with this and can provide some simple sample code. 
 If you need more detail, feel free to ask back.

 Thank you!

 Cheers,
 Charma

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





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