Hello,

This will be my first post, so feel free to correct me when I'm forgetting to 
explain some facts/not include neccesary files, when this seems obvious.

Let me first explain the situation. Last years december TheVirus (Bart Jan) 
posted some questions here, about setting up a view across multiple screens, 
when these screens are perpendicular to each other. To quote the situation:


TheVirus wrote:
> 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. 
> 
> [..]
> 
> 
> In the PcubeE paper 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. 
> 
> [/i]


Now, months later, I am assigned to finish the task Bart Jan started. We have 
created a cube, and our goal is to set up views so that we can 'look' inside 
the box. The purpose is to make it all embedded.
Since then, I already made quite some progress (to say it myself) with learning 
OSG and to apply it to a BeagleBoard (which is where the application will run, 
eventually). The code is made to run at three different processors, but within 
the code they will communicate to each other through a serial connection. The 
code is attached to this post, but please note that this code is adjusted from 
the Beagleboard to make it work on the PC (Visual Studio), so it may seem a bit 
loose. Still this was neccessary to disable sensors etc, and to make it 
possible to run at just one screen/processor.
To explain the functionality: In Box.cpp and CreateWindows.cpp you must define 
at which screen you are looking. BART = on top, MARTIJN = front/back and 
GERTJAN = from the side. With the keys 'a'/'d' you can simulate the sensor 
functionality, this represents rotating the cube around one axis.

In this code I am rotating the camera by setting the view matrix with the eye, 
center, up vectors. This is working. Note that I am setting the radius 
hardcoded (r = 10). Since the camera will start on-axis, that is facing the 
screen and looking directly inside the box, you will see all three objects. But 
when this camera is rotated, the projection matrix has to be adjusted, so that 
you can see a perspective view, only at one side of the 'box'. Eventually this 
view should dissapear, when the camera is at such a position, that it cannot 
see that side of the box.

And this is where the trouble begins. I am having trouble understanding how to 
correctly set up this projection matrix. If I understand correctly, I have to 
adjust the left/right settings of the frustum, so this will coincide with the 
left and right boundaries of the box. But how can I calculate these correctly? 
I have already tried some calculations with trigonometry, but these don't 
produce the result I am looking for. I'm beginning to think I may have a wrong 
understanding of where and how the frustum is defined, so please help. In the 
code, the frustum is calculated in the CustomCamera.cpp, when key 'a' is 
pressed.

I know there will be additional questions to further clear out this problem, 
because I may forget something to tell that seems obvious for me, so please 
don't hesitate to ask.

Thank you!

Chris[/quote]

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




Attachments: 
http://forum.openscenegraph.org//files/main_502.cpp
http://forum.openscenegraph.org//files/customcamera_503.h
http://forum.openscenegraph.org//files/customcamera_141.cpp
http://forum.openscenegraph.org//files/createwindows_156.cpp
http://forum.openscenegraph.org//files/box_158.cpp


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

Reply via email to