23 #if SILICONSTUDIO_PLATFORM_WINDOWS_DESKTOP && SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGL
24 using System.Windows.Forms;
26 using OpenTK.Graphics;
28 namespace SiliconStudio.
Paradox.Games
33 public partial class GameContext
38 public GameContext() : this(null)
48 public GameContext(OpenTK.GameWindow control,
int requestedWidth = 0,
int requestedHeight = 0)
50 var creationFlags = GraphicsContextFlags.Default;
51 int versionMajor, versionMinor;
53 #if SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGLES
56 OpenTK.Platform.Utilities.ForceEmbedded =
true;
57 creationFlags |= GraphicsContextFlags.Embedded;
63 if (requestedWidth == 0 || requestedHeight == 0)
65 requestedWidth = 1280;
66 requestedHeight = 720;
70 var defaultMode = GraphicsMode.Default;
71 var graphicMode =
new GraphicsMode(defaultMode.ColorFormat, defaultMode.Depth, 8, defaultMode.Samples, defaultMode.AccumulatorFormat, defaultMode.Buffers, defaultMode.Stereo);
73 GraphicsContext.ShareContexts =
true;
74 Control = control ??
new OpenTK.GameWindow(requestedWidth, requestedHeight, graphicMode,
"Paradox Game", GameWindowFlags.Default, DisplayDevice.Default, versionMajor, versionMinor, creationFlags);
75 RequestedWidth = requestedWidth;
76 RequestedHeight = requestedHeight;
77 ContextType = AppContextType.DesktopOpenTK;
90 public static implicit
operator GameContext(OpenTK.GameWindow gameWindow)
92 return new GameContext(gameWindow);