Question

I have a GameWindow consisting some animations in OpentTK, which I want to show in projector screen. Is the DisplayDevice class helpful for this case?

using OpenTK;

foreach (DisplayDevice device in DisplayDevice.AvailableDisplays)
{
    Console.WriteLine(device.IsPrimary);
    Console.WriteLine(device.Bounds);
    Console.WriteLine(device.RefreshRate);
    Console.WriteLine(device.BitsPerPixel);
    foreach(DisplayResolution res in device.AvailableResolutions)
   {
      Console.WriteLine(res);
   }
}

Please suggest me a way to show it in projector screen.

Was it helpful?

Solution

Assuming the projector is connected as the second display device, then the following will work:

        var projector =
            DisplayDevice.GetDisplay(DisplayIndex.Second) ??
            DisplayDevice.GetDisplay(DisplayIndex.Default); // in case the projector is unplugged
        var gw = new GameWindow(
            projector.Width,
            projector.Height,
            GraphicsMode.Default,
            "My Window",
            GameWindowFlags.Fullscreen,
            projector);

If you have more than two monitors, you will have to iterate on DisplayDevice.GetDisplay() until you discover the projector.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top