The OSG does support two displays attached to a single graphics card,
and will work either with X set up with a separate X screen per
physical display or a single screen spanning both displays. For best
performance it's best to set up a single X screen across both displays
as this will just require the OSG to open up a single graphics
context, which is a far more efficient use of the GPU than opening up
two graphics contexts that content for time and space on the GPU.
Depending upon how you set up the window manager you may find that you
windows are resized automatically to just come up on a single display,
if this happens it's because the window manager is overriding the
window sizes that you ask for when create your graphics context and
the way to solve it is to set the
GaphicsContext::Traits::overrideRedirect to true when creating your
> osg-users mailing list
osg-users mailing list
On Thu, Nov 20, 2008 at 12:09 AM, Michael <michael.t...@gmail.com> wrote:
> This fails on the second display because OSG can't connect to screen 0:1,
> because there is only 1 xscreen. Clearly I am doing this wrong, but I'm not
> sure of the correct way.
If you have only only X screen then you'll only be able to open up a
window on that one... so you'll need to use the screenNum set to 0 fro
both contexts, or....
> Something like this?
> 1. Create a single GraphicsContext on screen 0, with width=2048 (both
> 2. Create my views, and somehow tell each one to only render on half of the
If you a grabbing the whole of both displays I would create a single
graphics context that goes across both physical displays. Otherwise
you'll need to create two graphics contexts on the same X11 screenNum
but with the second window starting at a xpos of 1024.
Now what to do about the views depends upon you actual needs. Do you
have two separate logical views of doing you have single view that is
just made up of two cameras (like looking out of two adjacent
real-world windows that share the same view). If you have only single
view, then do the two halves of it but up against each other or do
Could you have a bash at explain what you are specifically trying to
achieve as the advice to give is different for all the different
Does you two "views" move together, i.e. they look different
directions but as the viewpoint moves around both projector outputs
should update relative to this? If this is the case they you have one
View but with two slave Cameras each with a project and view offset
from the View's master Camera.
If two projector outputs are wholly independent w.r.t viewpoint, and
require same camera controls such as seprate CameraManipulator then
you do have a case which is logically two different views.
On Wed, Nov 26, 2008 at 12:57 AM, Michael <michael.t...@gmail.com> wrote:
> Thanks for the clarrification. After reading through the OpenSceneGraph API
> docs we definitely require two views. So to summarise
> 2 monitors (projectors)
> 1 View on each monitor
> 1 XScreen, and therefore 1 context (if possible).
Yep this would be a sensible set up. With setting up the single
context you may need to set the Traits::overrideRedirect to true to
prevent the window manage resizing the window to just once physical
screen. Then create the graphics context, then when you set the each
View's master Camera you just assign the same created graphics context
so that both Cameras share things single window.
The osgcompositeview has code that shares a single context between
multiple views so have a look at it.