Fullscreen GL on 6 screens?

To enumerate devices/monitors etc. Look up ms gdi functions such as EnumDisplayDevices,EnumDisplayMonitors and CreateDC on msdn.

I think this exactly is the thing SGI boxes are good for

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

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.

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.

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.

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 :frowning:

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?

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.