Reputation: 6338
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.
Upvotes: 1
Views: 757
Reputation: 2794
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.
Upvotes: 1