Re: [osg-users] Render on two screens with an angle

2010-12-15 Thread Bart Jan Schuit
I've made some progress, but not the one I want. I'm trying to figure out how I 
set the cameras properly. I figure that the shearing is actually the easiest 
step, once you know how to set the cameras and the projections/views. But my 
question is: how should I set both cameras? And their projection matrix and 
view matrix? 
I've made two views, both with their own camera of course. But I think I cannot 
easily add a CameraManipulator like the TrackBall manipulator, as moving the 
camera might impose some problems I think. So I tried to just add a 
CameraManipulator, but VS tells me I cannot do that as it is an abstract class. 
Simply, I just want to have a view pre-set views where the camera moves to like 
3 or 5 positions, all around the camera point drawn above (so I can test for a 
couple of views, to see if the projections are correct). So how can I set the 
cameras this way? Because if I don't add a Manipulator, nothing is shown on the 
screen. 
But my main question is how to set the view and/or projection matrices for each 
camera correctly. Hope you can help me, I'm spending hours on trying stuff out 
but I can't figure out how it should be done.

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





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


Re: [osg-users] Render on two screens with an angle

2010-12-15 Thread Bart Jan Schuit
Hi Ulrich,

Thank you for your quick response. 
Well when I delete my CameraManipulator (Trackball), the screen goes blank 
(just blue or black background, depending on which model I load). So I assumed 
a Manipulator was needed. 
And I think I need two of them, so I can manipulate each camera independently.

The main problem I'm stuck on now is how to setup the view. I've made two 
views, fullscreen. But now they both show the same image. I do know how to 
change camera positions. I do not know where they should be in the first place 
and which direction they face. I didn't quite understand that from your reply. 
The same goes for the views: how do I set the views correctly, so they are 
sheared? How should I set the viewmatrix (with what values but also where and 
how), the projection matrix etc.  Because the view and projection matrix can 
only be set via a camera. But I cannot manipulate a camera myself, because a 
Manipulator is defined. And through the manipulator I cannot set the projection 
and view matrix.
Maybe it's just a dumb question, I'm sorry for that. I'm completely new to 
programming with OpenGL and OSG. Made some examples, read the QSG and a lot of 
forum posts, but I still don't get it. 

Thank you alot for your help.

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





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


[osg-users] Setting camera Viewmatrix with TrackBallManipulator Matrix gives nothing but black screen

2010-12-15 Thread Bart Jan Schuit
Hi,

I'm trying to setup some cameras without a manipulator. When I assign a 
Trackballmanipulator on the vies, I get the cow projected on the screen. But as 
soon as I manually setup the cameras, I get a completely black screen.
I extract eye, center and up from Tman (Trackballmanipulator) by 
Tman-getMatrix().lookat(eye, center, up).

This gives some nice coordinates, but when I put these in a camera without a 
manipulator like Tman, I just get a black screen. What am I doing wrong here?


Code:

int main( int argc, char **argv )
{

// use an ArgumentParser object to manage the program arguments.
   osg::ArgumentParser arguments(argc,argv);



osg::Group* scene = new osg::Group();
osg::Node* groundNode = NULL;
groundNode = osgDB::readNodeFile(cow.osg);

scene-addChild(groundNode);

osgViewer::CompositeViewer viewer(arguments);

if (arguments.read(-2))
{

// view one
{

osg::Vec3d eye = osg::Vec3d(0,0,250);
osg::Vec3d center = osg::Vec3d(0,0,250);
osg::Vec3d up = osg::Vec3d(0,0,-1);
osg::Quat rotation;
osg::Matrixd viewmat;

osg::Camera* camera = new osg::Camera;
osgViewer::View* view = new osgViewer::View;
view-setName(View one);
viewer.addView(view);
//camera-setProjectionMatrix( osg::Matrix::ortho2D(0,512,0,512) );  //not 
doing anything 
//camera-setReferenceFrame( osg::Transform::ABSOLUTE_RF );
//camera-setViewMatrix( osg::Matrix::identity() );
view-setCameraManipulator(Tman);
//Tman-setAutoComputeHomePosition(false);
view-setUpViewOnSingleScreen(0);
view-setSceneData(scene);
//view-setCamera(camera);

}

// view two
{
osg::Matrixd viewmat;
osg::Camera* camera = new osg::Camera;
osgViewer::View* view = new osgViewer::View;
view-setName(View two);
viewer.addView(view);
view-setUpViewOnSingleScreen(1);
view-setSceneData(scene);
//view-setCamera(camera);
view-setCameraManipulator(Tman);
view-setName(right);
osg::Vec3d eye = osg::Vec3d(0,0,25);
osg::Vec3d center = osg::Vec3d(0,0,25);
osg::Vec3d up = osg::Vec3d(0,0,-1);
}
}
viewer.realize();



while(!viewer.done())
{   

osg::Vec3d eye = osg::Vec3d(0,0,50);
osg::Vec3d center = osg::Vec3d(0,0,50);
osg::Vec3d up = osg::Vec3d(0,0,-1);
Tman-setHomePosition(eye,center,up); //not working. Doesn't 
matter how I set eye, center etc.
viewer.frame();
}
}




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





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


Re: [osg-users] Render on two screens with an angle

2010-12-15 Thread Bart Jan Schuit
Hi Ulrich,

Thank you again for your patience and insight.
Your code makes absolute sense. But I still get the same result. If I have no 
trackball manipulator for either view, I get a black screen. When I have set it 
up for one view, only that view gets an image. My code:

Code:

osg::Group* scene = new osg::Group();
osg::Node* groundNode = NULL;
osg::Node* tankNode = NULL;
groundNode = osgDB::readNodeFile(cow.osg);

scene-addChild(groundNode);
osgGA::TrackballManipulator* Tman = new osgGA::TrackballManipulator;

// construct the viewer.
osgViewer::CompositeViewer viewer(arguments);


if (arguments.read(-2))
{

// view one
{

osg::Camera* camera = new osg::Camera;
osgViewer::View* view = new osgViewer::View;
view-setName(View one);
viewer.addView(view);

view-setUpViewOnSingleScreen(0);
view-setSceneData(scene);

// Get the scene bounding sphere
osg::BoundingSphere bsph = scene-getBound();

// Look at the center of the scene
osg::Vec3 lookAt = bsph.center();

// Place eye at an appropriate distance 'south' of the look-at point
osg::Vec3 eyef = lookAt + osg::Vec3(0,-1,0) * bsph.radius() * 3.5f;

// Set camera view matrix
camera-setViewMatrixAsLookAt(eyef, lookAt, osg::Vec3(0,0,1)); 
view-setCamera(camera);
}

// view two
{
osg::Camera* camera = new osg::Camera;
osgViewer::View* view = new osgViewer::View;
view-setName(View two);
viewer.addView(view);

view-setUpViewOnSingleScreen(1);
view-setSceneData(scene);

// Get the scene bounding sphere
osg::BoundingSphere bsph = scene-getBound();

// Look at the center of the scene
osg::Vec3 lookAt = bsph.center();

// Place eye at an appropriate distance 'south' of the look-at point
osg::Vec3 eyef = lookAt + osg::Vec3(0,-1,0) * bsph.radius() * 1.5f;

// Set camera view matrix
camera-setViewMatrixAsLookAt(eyef, lookAt, osg::Vec3(0,0,1)); 
view-setCamera(camera);
//view-setCameraManipulator(Tman);
}
}

viewer.realize();


while(!viewer.done())
{   

viewer.frame();
}




I must be missing something obvious I guess, but for me it isn't obvious (yet). 

Thank you!

Cheers,
Bart Jan

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





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


Re: [osg-users] Render on two screens with an angle

2010-12-14 Thread Bart Jan Schuit
Thank you for your quick response. I still have some questions though, sorry 
;). 


Ulrich Hertlein wrote:
 On 14/12/10 10:23 , Bart Jan Schuit wrote:
 
 As I understand it, they're setting up two cameras, located in the eye point 
 '0'.
 Camera 1 is projecting onto the vertical screen, and camera two is projecting 
 onto the
 horizontal screen (as per your drawing).
 

How do you set this up in code? Just make two cameras and two views and that's 
it, or do I need to set projections in a certain direction. If so, how?

 
 Camera 1 would look due right (down the X axis in your drawing), and camera 2 
 would look
 up/north (down the Y axis in your drawing).
 

I understand this, I think. Please correct me if I'm wrong though: The 'view' 
of each camera must go through it's own frustum. And these frustums are drawn 
in my code drawing.


 The frustum for camera 1 would then be *sheared* (not rotated) in the 
 positive Y direction to coincide with the bounds or the projection rectangle.

Shouldn't I shear both? And both for like 45 degrees (if you can speak of 
degrees. Hope I understand it correctly and you do ;)). And how do you shear in 
OSG? What is the code for that?

Thank you very much for your help. The concept is beginning to become clear. 
But I don't have an idea how to put this in code. Can you tell me of some of 
the functions I need?

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





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


Re: [osg-users] [build] Inventor not working with GLES1.x?

2010-12-14 Thread Bart Jan Schuit
Hi Robert,

Thank you very much. Will try it out :).

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





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


[osg-users] [build] Inventor not working with GLES1.x?

2010-12-13 Thread Bart Jan Schuit
I've got a problem with compiling OSG for GLES1.1 on Ubuntu. I have the 
Imagination GLES1.x emulator installed, but I'm having some problems compiling 
OSG. I've followed the guidelines on /wiki/Community/OpenGL-ES and I've 
succesfully compiled for GLES2.0 before on this very system (also have 
Imagination GLES2.0 emulator). 
However, with GLES1.x there seems to be a problem with the Inventor or ive 
plugin, which seems to be using the regular OpenGL headers for some reason. 
Anyway, this is the error I get:

Code:

[ 67%] Building CXX object 
src/osgPlugins/ive/CMakeFiles/osgdb_ive.dir/DrawElementsUShort.o
In file included from /usr/include/Inventor/system/gl-headers.h:40,
 from /usr/include/Inventor/system/gl.h:38,
 from /usr/include/Inventor/C/glue/gl.h:33,
 from /usr/include/Inventor/nodes/SoShaderObject.h:33,
 from /usr/include/Inventor/nodes/SoVertexShader.h:27,
 from 
/home/user/OpenSceneGraph-2.9.9/OpenSceneGraphGLES1/src/osgPlugins/Inventor/ConvertFromInventor.cpp:64:
/usr/include/GL/glext.h:7232: error: expected ‘,’ or ‘...’ before ‘*’ token
/usr/include/GL/glext.h:7233: error: ‘GLclampd’ has not been declared
/usr/include/GL/glext.h:7233: error: ‘GLclampd’ has not been declared
/usr/include/GL/glext.h:7243: error: expected ‘,’ or ‘...’ before ‘*’ token
/usr/include/GL/glext.h:7244: error: ‘GLclampd’ has not been declared
/usr/include/GL/glext.h:7244: error: ‘GLclampd’ has not been declared
In file included from /usr/include/Inventor/system/gl-headers.h:40,
 from /usr/include/Inventor/system/gl.h:38,
 from /usr/include/Inventor/C/glue/gl.h:33,
 from /usr/include/Inventor/nodes/SoShaderObject.h:33,
 from /usr/include/Inventor/nodes/SoVertexShader.h:27,
 from 
/home/user/OpenSceneGraph-2.9.9/OpenSceneGraphGLES1/src/osgPlugins/Inventor/ConvertFromInventor.cpp:64:
/usr/include/GL/glext.h:9550: error: variable or field ‘glDepthBoundsEXT’ 
declared void
/usr/include/GL/glext.h:9550: error: ‘GLclampd’ was not declared in this scope
/usr/include/GL/glext.h:9550: error: ‘GLclampd’ was not declared in this scope
/usr/include/GL/glext.h:9552: error: typedef ‘PFNGLDEPTHBOUNDSEXTPROC’ is 
initialized (use decltype instead)
/usr/include/GL/glext.h:9552: error: ‘GLclampd’ was not declared in this scope
/usr/include/GL/glext.h:9552: error: ‘GLclampd’ was not declared in this scope
make[2]: *** 
[src/osgPlugins/Inventor/CMakeFiles/osgdb_iv.dir/ConvertFromInventor.o] Error 1
make[1]: *** [src/osgPlugins/Inventor/CMakeFiles/osgdb_iv.dir/all] Error 2



Can anyone shed some light on this? I just finished GLES2.0 compiling and that 
worked fine, but GLES1.x doesn't seem to work :S.

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





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


[osg-users] [build] Cannot make target:

2010-12-13 Thread Bart Jan Schuit
When I'm building OSG on a BeagleBoard in Angstrom Linux I get this error:

make[2]: *** No rule to make target `/usr/lib/libpng.so', needed by 
`lib/osgPlugins-2.9.11/osgdb_png.so'.  Stop.
make[1]: *** [src/osgPlugins/png/CMakeFiles/osgdb_png.dir/all] Error 2
make: *** [all] Error 2

I've checked libpng.so and it is there. Even reinstalled it, also the dev and 
dbg versions of the lib, to no avail. 
It has compiled successfully before, so I got no idea what is wrong here. I've 
retried three times already (which is a real pain as compiling takes 10 hours, 
since I didn't manage to set up a cross compiling environment), everytime 
downloading again from SVN trunk. But everytime I get this error. Hope you can 
help me with this ;). Thank you in advance for your help!

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





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


Re: [osg-users] [build] Cannot make target:

2010-12-13 Thread Bart Jan Schuit
Sorry fixed it already myself. Somehow the symlinks were broken, although they 
worked before :S. But the reference was wrong now.

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





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


[osg-users] Render on two screens with an angle

2010-12-13 Thread Bart Jan Schuit
I want to build an app which should have one camera (or two identical, meaning 
that they are at the same position, facing the same direction, if that is more 
convenient) and multiple screens. The screens will be aligned in a 90 degree 
angle towards each other. So they are perpendicular:
top view:

Code:

  | - 1 
  |  2
  |  |
  |  v
  |


O



Where O is the eye or camera. It's like looking at a box with holes in all 
sides and you want to see the inside. And the screens on which I want to 
project are the sides of the box. 
It's a bit like the PcubeE, but then with only two screens:
http://hct.ece.ubc.ca/research/pcubee/ and 
http://www.youtube.com/watch?v=2iV0Icy41JM
I've been messing with ViewMatrix, ViewProjectionMatrix, frustums etc. but I 
cannot get the result I want. I've looked at dozens of examples (like 
3rdperson, windows, sidebyside, compositeviewer, etc.) but I do not really get 
the idea how to set this up, quite lost in all the possibilities at the moment.
In the PcubeE paper 
(http://hct.ece.ubc.ca/publications/pdf/stavness-lam-fels-CHI2010.pdf) they say:
To generate perspective-corrected images on each screen of pCubee, we use a 
standard off-axis projection scheme as described by Deering [9]. This is done 
in OSG by creating three View objects that correspond to the three visible 
screens on pCubee. The camera for each View is located at the user’s 
eye-position (which I will set manually at like right in the middle of the two 
screens, so at 45 degrees), oriented perpendicular to its corresponding virtual 
screen, and given a view frustum that passes through the corners of its virtual 
screen. 
Setting the near-clip plane coincident with the screen plane prevents rendering 
of virtual objects in front of the screens, which would cause occlusion issues 
at the screen edges. Synchronization between screens is handled within OSG: the 
separate  Views are contained within a single  CompositeViewer object and the 
camera parameters in each View are updated before a single call is made to  
CompositeViewer to update all the Views simultaneously. 

Well my question is: how do you do that in code. I'm sorry, I just started 
programming for OSG so I'm a noob :(.

[/i]

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





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