PDA

View Full Version : Fullscreen GL on 6 screens?



Milo_Mindbender
05-27-2003, 09:19 PM
I have an application (a simulator) where I need to bring up as many as 6 accelerated screens at once, one is for a 3d "out the window" view and the rest are for instrument panels.

The configuration will be using Windows XP, 3 dual-head NVIDIA GeForce cards (1AGP and 2PCI) and six seperate monitors.

Effectively, I want to setup each monitor as a seperate full-screen display and need some accelerated GL support on them all.

Does anyone know how to go about doing this? I have a pretty good idea how to do it with D3D but am not sure at all about how to do it with OpenGL.

I don't have any problems with using windows-specific calls to setup the windows and rendering contexts, but I want the bulk of the code to be GL in case I want to port it over to a different OS later on.

Any help, particularly code samples, would be appreciated.

knackered
05-27-2003, 11:27 PM
Good luck.
From my experience, you only get opengl acceleration on the 'primary' card (in your case, the AGP card). The other cards (PCI) will not be accelerated.
There was some talk from nvidia about sorting this out, but I really think it's more down to microsoft to sort out - which ain't gonna happen.

tfpsly
05-27-2003, 11:32 PM
I'd say that you'll have to use several computers to have acceleration on each of the 6 monitors. At least 2 computers if you're using a card like the one made by matrox, which can render to 3 monitors at the same time.

But as your 5 secondary view will be "quite simple" - compared to the main view, maybe you'd better just program a software renderer for these views, and use OpenGL for the main one?

Thaellin
05-28-2003, 04:05 AM
True that you can only get an accelerated OpenGL context for the primary adapter. You /may/ be able to get an accelerated context spanning both desktops of a dual-head nvidia card with some kind of effort.

As for the other four displays, my first thought is that you're out of luck.

My /second/ thought is that you can get an accelerated context for the primary adapter, and that you can change the primary adapter through the desktop settings control without rebooting.

IF the existing context remains valid when taking 'primary' status away from a display, and if you can change which adapter is primary programmatically, then you might have options. If there is no API to change the primary adapter, then you might have to muck the registry to trick Windows.

Interesting line of thinking, anyway... Let me know if it pans out - you'll probably have a chance to test it before I do.

-- Jeff

knackered
05-28-2003, 04:13 AM
I wouldn't waste your time.
Not only have I tried *everything* in the past, but I've also seen this same thread crop up time and time again. Nobody, and I mean *nobody* has come up with a solution...go on, search the archives of this forum.
Yes, nvidias twin view works fine from a dual headed single card - you can have accelerated opengl across both screens ok, no problem, lovely. But that's because as far as windows is concerned it's one primary display.
The only solution I came up with for this problem was to use direct3d for the less important views. It sure ain't purty, but it got the job done.

V-man
05-28-2003, 05:25 AM
I thought NVidia said they would have a fix in their drivers by last summer (2002). Maybe it's in their Quadro line?

Otherwise, if I was you, I would go for D3D. Software mode is ridiculous.

Coconut
05-28-2003, 05:46 AM
I guess there is indeed a real case when D3D is preferable to OpenGL.

Mezz
05-28-2003, 06:19 AM
I don't know about full screen, but is it possible to get acceleration in a window on the non-primary monitors?

-Mezz

LordOfTheUniverse
05-28-2003, 12:24 PM
Simply switch to Linux and use XWindows with Xinerame - it can combine many hardware screens into one logical.

Humus
05-28-2003, 12:53 PM
Originally posted by Mezz:
I don't know about full screen, but is it possible to get acceleration in a window on the non-primary monitors?

Yes. There can be problems on some cards though if the window spans over two monitors.

Milo_Mindbender
05-28-2003, 01:04 PM
I've been told by engineers at NVIDIA that, at least with their current cards and drivers this should be possible so long as the window is made on the target monitor and not made somewhere else and then moved.

However, I haven't seen any sample that does it.

I originally wanted to do this project under Linux, but have had to move it to Windows because the drivers for many things I need simply don't exist on Linux right now or aren't well developed enough.

At this point, if GL can't be made to work with 6 screens, I may have to go the DirectX route.

Milo_Mindbender
05-28-2003, 04:15 PM
Now that I think about it, maybe a more productive question would be this....

If you were going to open full-screen OpenGL windows on 6 different monitors, how would you go about it?

Are the WindowsXP wgl calls the way to go, or should I be using DirectX calls to do it?

Sorry if at least part of this is a bit basic, most of the sample code I've grabbed (so far) uses GLUT which isn't terribly helpful if you want to open windows on 6 different screens.

jwatte
05-28-2003, 05:09 PM
I can see two ways of trying it:

1) create one big window covering the entire virtual desktop.
Set pixel format, create context, and all that.
With luck, if you use the same driver and card family for all three cards, this might just work.
Then split your large window into 6 regions using viewport and/or scissoring.

2) create one window that exactly matches the dimensions of each screen, making it borderless.
Set pixel format for each window, create context for each window.
Perhaps the Gods would smile upon you and this would give acceleration, too.

Please, report back what you find!

rgpc
05-29-2003, 07:43 PM
Originally posted by tfpsly:
I'd say that you'll have to use several computers to have acceleration on each of the 6 monitors.

That's how the Boeing F/A-18F simulator operates. It has a single (dual CPU) for the primary display & main simulation and a pc for each of the cockpit displays (4 per cockpit from memory - maybe 5 for the rear cockpit). Can't say I noticed what the gfx cards were though...

roffe
05-29-2003, 09:17 PM
Originally posted by rgpc:
That's how the Boeing F/A-18F simulator operates. It has a single (dual CPU) for the primary display & main simulation and a pc for each of the cockpit displays
Interesting.How do they connect the pc's with the main system?

[This message has been edited by roffe (edited 05-29-2003).]

rgpc
05-29-2003, 10:18 PM
Originally posted by roffe:
[BInteresting.How do they connect the pc's with the main system?
[/B]

I didn't even think to look at the networking setup (I suspect I would have only seen a cat5 disappearing into the wall somewhere).

Each machine was Win2k - I know this because the whole system froze when I had a turn and was approaching the carrier. And the primary pc was dual AMD2k+MP's. It was quite a process to restart the machine but it looked like it could be done centrally. VNC or a simple switch box - I couldn't see what was happening as the primary PC was behind me.

Made me want to setup one at home using Falcon (now if I could just get the source...) http://www.opengl.org/discussion_boards/ubb/smile.gif

shinpaughp
05-29-2003, 11:00 PM
Check out VT-CAVE (http://www.cave.vt.edu) and DIVERSE (http://diverse.sourceforge.net/) .

At the CAVE its not all work and research... they also have Quake and a few other games set up. http://www.opengl.org/discussion_boards/ubb/biggrin.gif

[This message has been edited by shinpaughp (edited 05-30-2003).]

kieranatwork
05-30-2003, 12:55 AM
Originally posted by roffe:
Interesting.How do they connect the pc's with the main system?

Ethernet probably handles the data propagation, while genlocking keeps the swapbuffers in sync. Wildcats support genlocking (as well as various other pro cards). Probably uses the WGL_I3D_swap_frame_lock extension.

[This message has been edited by kieranatwork (edited 05-30-2003).]

dorbie
05-30-2003, 04:35 PM
Yep, but you don't need genlock (or framelock) just for heads down displays. You can implement a few tricks to sync without genlock too on some cards, but it's tricky.

100 BaseT would almost certainly be the networking of choice on a system like that but some people are using gigabit ethernet.

If you're going to try something like this where you gang displays I'd suggest you investigate Open Producer:
http://www.andesengineering.com/Producer/

This is from the original author of Open Scene Graph. The videos on this page may inspire you, it shows the kind of rack based hardware setup he has at the end of the video:
http://www.andesengineering.com/old/products.html

You really want one of these to do a decent job though:
http://www.aechelon.com/products/pcnova/PCN5.htm

More info on the setup with operators console info etc:
http://www.aechelon.com/products/pcnova/PCN1.htm

Milo_Mindbender
05-30-2003, 07:04 PM
I appreciate the ideas about using multiple computers, but this isn't an option for my application. Using 6 computers (or even 3) would be too expensive and too difficult to maintain, not to mention it would take up a lot of space.

I'm starting to work on some test code but am having problems with the first step, that is, getting OpenGL windows open on each device.

I've done a lot of graphics code but I'm afraid I'm sufferning from not having written Microsoft Windows code for some time so I could use a little help getting going.

Essentially, what I'm stuck on is the proper way to enumerate all the monitors and then open a GL window on each one. Just figuring out which parts of the windows docs I should be reading is kind of tough. Is this something that can be done with GDI routines, wgl routines, direct X or some combination of them all?

Any help, particularly pointers to sample code that would apply, would be very helpful.

roffe
05-30-2003, 07:21 PM
To enumerate devices/monitors etc. Look up ms gdi functions such as EnumDisplayDevices,EnumDisplayMonitors and CreateDC on msdn.

nrg
06-01-2003, 07:19 AM
I think this exactly is the thing SGI boxes are good for http://www.opengl.org/discussion_boards/ubb/smile.gif

You could do this with one SGI box, using
multiple display adapters.

But then, if you don't have drivers for Linux, I think they don't exist for IRIX either http://www.opengl.org/discussion_boards/ubb/frown.gif

Milo_Mindbender
06-01-2003, 01:02 PM
So, I grabbed the NeHe basecode (http://nehe.gamedev.net/files/basecode/nehegl_simple.zip) as a starting point and started to add code to try and deal with multi-head.

Briefly, NeHe's startup code does this....

hWnd = CreateWindowEX(...
hDC = GetDC(hWnd)
hRC = wglCreateContext(hDC)
wglMakeCurrent(hDC,hRC)

And you end up with a window that clears to black and updates till you click the close box (non-fullscreen-mode).

So far, I'm having a lot of trouble getting anything OpenGL to work on the second screen at all. Here are the scenarios I've tried so far.

First, I try the code without mods, works ok on the main screen but if I drag the window to the second screen, it stops updating.

Second, I EnumDisplayMonitors to find the coordinates of the second monitor. I create the window and the window frame appears on the second monitor, but it's empty (it doesn't clear to black). Move the window back to the main monitor and it works.

Third, substitute GetWindowDC for GetDC. Same problem.

Fourth, changed the GetDC to this
hDC = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL)
which is supposed to give you a context for the whole desktop, this fails when we try to make i
wglMakeCurrent(hDC,hRC)

This part was a bit confusing, because I thought one of the above methods would give me a GL window that worked on both screens, but only do hardware on one.

I also wrote code to enumerate all the Adaptors and monitors with EnumDisplayDevices then used the adaptor and monitor names to try and make a DC with CreateDC. Once again, I either got a failure to create the DC or after having successfully created it was unable to activate it.

Any ideas on what I might be doing wrong? I have both monitors attached to an NVIDIA 4600, both are attached to my windows desktop and active.

Milo_Mindbender
06-01-2003, 01:38 PM
By the way, if anyone has an OpenGL sample that works AT ALL (even if it's not accelerated on both screens) on a windows multimon setup, I'd love to see the code.

Humus
06-01-2003, 02:11 PM
As long as you make sure that the window is opened on one monitor only, is created with the visible flag and and not minimized or anything such before creating the OpenGL context it should work.

jwatte
06-01-2003, 03:39 PM
If you set both your monitors to the same display size, and click the "merge all monitors to one desktop/device" button in the control panel, then you can create a window anywhere and it'll work.

Not all drivers/control panels have that button, unfortunately :-(

rgpc
06-01-2003, 05:29 PM
Originally posted by Milo_Mindbender:
First, I try the code without mods, works ok on the main screen but if I drag the window to the second screen, it stops updating.

I seem to remember reading somewhere (quite some time ago) that you have to create your context for the window while it is on the second display (ie. A context on Display 1 is not valid if you try to move it to display 2)



Second, I EnumDisplayMonitors to find the coordinates of the second monitor. I create the window and the window frame appears on the second monitor, but it's empty (it doesn't clear to black). Move the window back to the main monitor and it works.


This sounds a little wierd to me. You create the window so that it appears on the second display? Then you create the GL context and it doesn't work until you move the window back to the primary display? Are you calling glError() to see what errors you are getting while it is on the secondary display?

Milo_Mindbender
06-01-2003, 07:59 PM
Well guess what...while I was running tests this afternoon I rebooted my machine and suddenly the original sample works now!

No more empty window frames regardless of which monitor I make the window on. (this is on an NVIDIA 4600 dual-head card) I can even move the window from monitor to monitor and it keeps working.

I think acceleration is working, but it's tough to be positive because I'm not drawing a whole lot (about 600 immediate mode triangles). I need to setup a better test case for this.

No clue what the reboot solved, but everything seems to be happy now.

One thing I still can't do is open up the second monitor as an "independant display" (mentioned onthe MSDN site). I use the display properties dialog and uncheck the "extend desktop onto this monitor" box for the second monitor, then I run my program and attempt to CreateDC onto that monitor. Unfortunately, the monitor doesn't wake up. I imagine there is some other initialization thing I'm missing here, if anyone has an idea what it is, please let me know.

I'll work up a better test case to make sure acceleration is working and let you all know how it goes.