Multiple render monitors support patch – by Nir Hasson
I just committed Nir's patch to the trunk.
If there are any new problems that you see after updating the trunk code – post here.
Patch notes:
OGRE interface changes:
* Root::getDisplayMonitorCount() method added.
* "monitorIndex" parameter added to misc parameters of render window.
Feature implemented:
* D3D9 Render system supports multiple device creation.
* Multiple full screen render windows creation is now allowed.
* D3D9 multi-head feature on multi-head cards is used where possible.
* Resource creation policy support added( now there are two options):
1. Create on active device - the resource is created on active device only. If the resource does not exist on a device that needs it - it will be created on the fly. This policy is memory friendly but might cause performance issues when working intensively with a background loader thread.
2. Create on all devices - when a resource is being loaded it create itself on every existing devices. That policy consumes memory but is good when working with background loader thread.
* On the fly device switch is done - when dragging a windowed render window to a different display monitor, the window will automatically link to the optimal device.
Remark: You will have performance if a window extends to more then one monitor.
* Added to OpenGL render system a minimal support for multiple display monitors. Multi-monitor support in OpenGL is limited compared to D3D and required specific company extensions (ex: WGL_NV_gpu_affinity) – this patch cover all that it can before using such extensions.
If you want to see this patch in action – look for MULTIPLE_MONITOR_RENDER_MODE in the playpen.
I just made a quick commit to some leftovers:
* Replaced the std::map and std::vector to the way that support the costume memory allocator.
* Updated the vc7 and vc9 projects.
enkuklios, there is a couple of ways to span a scene across multiple monitors.
1- Span your monitors with Nvidia drivers. You don't need the patch, but it only works with NVidia drivers (and I heard it doesn't work on vista either)
2- Make 2 RenderWindow with 2 cameras side-by-side. If you have 90deg FOV horizontally, rotate both of them 45deg on opposite direction. The resulting images will looks like the scene got broken in half, in a kind of triangle if you see what I mean, but depending on what you're doing it might be fine.
3- Lastly, you do as number 2, but you set the projection matrix of the 2 frustums to make them parallele, as if you had a single frustum. It fixes the problem of #2 but you need more tweaking.
patching file OgreD3D9GpuProgramManager.h
Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354
This application has requested the Runtime to terminate it in an unusual way.
patching file OgreD3D9GpuProgramManager.h
Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354
This application has requested the Runtime to terminate it in an unusual way.
I had the same problem using the patch.exe utility, but then I've tried to merge the patch with the utility in Tortoise SVN and all works as expected...
<Kiske>
Well can you blame us? For living our dreams...
- Twisted Sister -
I am trying to use this patch to combine multiple screens together. So far, I attached two cameras to two render windows, one for each, and adjusted the cameras to make it looks like a window that cross 2 screens.
It looks like this:
I have some problems in applying CEGUI to my program. As you can see, the GUI appears on both render windows.
I want it to appear only on one of my render windows.
I have tried to change the render window in CEGUI::OgreCEGUIRender function, but it's still the same.
Does anyone know how can I show it only on one render window?
I think should be a good idea to have in future versions an "overlay management", because many times there's the need to have some overlays in one renderwindow and other in the other renderwindow. I've implemented this through RenderTargetListeners, hiding or showing the overlays in the preRender event, but I need to mantain (and keep up to date) a list of overlays, and imho it's not a neat way to achive the result....
Just an idea would be adding a renderwindowlist in the overlay properties that someway tells the renderer in wich windows show this specific overlay and in wich not... Creating the overlay with this list void means all renderwindows shows the overlay....
<Kiske>
Well can you blame us? For living our dreams...
- Twisted Sister -
Wow, that is very impressive. I was thinking about something like this (on one monitor you have the game and on the other the controlls to setup some parameters, some other view to see what is rendered, etc.). Finally I ended with two apps - one the game and second the editor both communicating through lan. It was quite handy but the time I spent writing all that communication stuff (and synhronising the views) was not worth the effect.
Can you tell me more detail about how did you use RenderTargetListeners to achieve this?
I have some problems again.... I want to show different GUI on each screen, but disable Overlays can not allow me to do this...
I have read this thread: http://www.ogre3d.org/forums/viewtopic.php?p=301408
and the other thread that you mentioned: http://www.ogre3d.org/forums/viewtopic. ... &view=next
but I am still not very sure how to do it, sorry.... I am a very beginner in Ogre3D
Can you tell me more detail about how did you use RenderTargetListeners to achieve this?
I have some problems again.... I want to show different GUI on each screen, but disable Overlays can not allow me to do this...
I have read this thread: http://www.ogre3d.org/forums/viewtopic.php?p=301408
and the other thread that you mentioned: http://www.ogre3d.org/forums/viewtopic. ... &view=next
but I am still not very sure how to do it, sorry.... I am a very beginner in Ogre3D
MattStevens wrote:enkuklios, there is a couple of ways to span a scene across multiple monitors.
2- Make 2 RenderWindow with 2 cameras side-by-side. If you have 90deg FOV horizontally, rotate both of them 45deg on opposite direction. The resulting images will looks like the scene got broken in half, in a kind of triangle if you see what I mean, but depending on what you're doing it might be fine.
3- Lastly, you do as number 2, but you set the projection matrix of the 2 frustums to make them parallele, as if you had a single frustum. It fixes the problem of #2 but you need more tweaking.
wizzler wrote:Nice patch. Especially combined with two different scene viewers. Perhaps it would be possible to implement ATI's eyefinity directly in OGRE.
As far as I understand - it is impossible to implement eyefinity in a different way then actually using eyefinity.
eyefinity enables you to treat multiple monitors as a single monitor - then you can only render once for multiple monitors.
The problem with eyefinity is the field of view for the "side monitors" - you will see the image starched without special compositors.
I didn't get to try eyefinity out yet - but if I will be able to solve the "side monitors" issue - I think it will be a real performance boost.
Thanks Assaf and Nir for this update. Our project uses the multi-head feature to render on two fullscreen windows on two different displays simultaneously but there seems to be some issues with device lost/restored handling with this setup. As a note the device lost/restored works perfectly if I configure the application to use only one fullscreen window.
Here's some debug info regarding the behavior with multi head (on a Win7 system) with 2 output windows:
after start-up both windows render correctly
click-selecting on the secondary window keeps focus on the fullscreen windows
after first device lost+restored event pair (by activating another window with alt-tab and re-activating primary render window):
primary window renders correctly
secondary window is no longer rendered: calling swapbuffers on it switches between a black frame and the last frame rendered on the window
selecting the secondary window causes the fullscreen windows to lose focus
OGRE EXCEPTION(3:RenderingAPIException): Cannot reset device! in D3D9RenderWindow::reset at .\src\OgreD3D9Device.cpp (line 421)
destroying a window or deleting ogre root object throw AccessViolationException
Has anyone observed this behavior before? Is there something that can be done about it? I've looked around device handling in the source but don't feel like I'm the right person to sort this out on the source level.
Hi, thanks for this patch, I was wondering if i could use this to render a scene in multiple monitors each one attached to a pc. and updating the whole scene rendering via network.
An example would be a ring of monitors and the user in the centre of them, if the user walks through a terrain, all the monitors should reflect the movement according to the whole scene. (each monitor attached to a CPU)