lagz's picture

Multiple monitors

Hi,

I am developing an application which will use two monitors. I want to one monitor to have a fullscreen opengl window (not a problem with openTk!), however I want the other monitor to show the windows desktop as normal.

Whatever I try the second monitor blacks out (nothing on it but black) when I make the openGl window fullscreen. Is there a way around this short of 'faking' fullscreen mode using a normal window with no border?

Thanks


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

The only workaround I've been able to find is to create a maximized, borderless window instead of a fullscreen one.

I've been searching for an actual solution, but I haven't found one yet. Do let me know if you find out anything relevant!

lagz's picture

Hmm. I haven't fount any fully satisfactory solutions. Basically I want to:
1. Select the display
2. Change the resolution of the selected display
3. Put the window on that display, so that it appears to be fullscreen. Other displays should not be disabled

I found this method in the forum:

// Place in the the parent Form
public void SwitchToFullscreen(int width, int height)
{
    this.FormBorderStyle = FormBorderStyle.None;
    this.TopMost = true;
 
    // Change the resolution of the primary monitor.
    DisplayDevice.Primary.ChangeResolution(width, height, 32, 60.0f);
 
    // Go fullscreen
    this.WindowState = FormWindowState.Maximized;
}

The problem with this is that it assumes the screen in the primary device. I want to be able to select the device. I have come up with

public void SwitchToFullscreen(Screen screen)
{
this.WindowState = FormWindowState.Normal;
this.FormBorderStyle = FormBorderStyle.None;
this.TopMost = true;
Cursor.Hide();
this.Bounds = screen.Bounds;
}

which makes the window appear fullscreen on mScreen. The problem with this is that the resolution is not changed. Can I assume that Screen.AllScreens (In the C# library) and DisplayDevice.AvailableDisplays will list the available displays in the same order? If so then I guess this solves my problem, although I cant help but think openTk should make this much easier.

In particular why doesn't the DisplayDevice class include a Bounds property?!

lagz's picture

Just to sum up the above:

It would really really help if DisplayDevice included a Bounds property, like the C# Screen class. This would allow users to position windows relative to their screen of choice!

the Fiddler's picture

Hm, the use case is solid. I'll try to add this in a future version.

It is safe to assume that the primary DisplayDevince is the same as the primary Screen, but it is not safe to assume that the rest are enumerated in the same order.

lagz's picture

Thanks. Any idea when this might happen? I don't know how it would be implemented, but I would guess its a fairly straightforward call into the underlying system?

the Fiddler's picture

It's relatively straightforward (at least, if you don't plan to support legacy systems). Still, developing, testing and debuging does take some time.