diff --git a/Source/OpenTK/Platform/MacOS/MacOSFactory.cs b/Source/OpenTK/Platform/MacOS/MacOSFactory.cs index 091c1150..613d2d77 100644 --- a/Source/OpenTK/Platform/MacOS/MacOSFactory.cs +++ b/Source/OpenTK/Platform/MacOS/MacOSFactory.cs @@ -43,35 +43,34 @@ namespace OpenTK.Platform.MacOS internal const float ScrollFactor = 0.1f; internal static bool ExclusiveFullscreen = false; - readonly IInputDriver2 InputDriver = new HIDInput(); + readonly IInputDriver2 InputDriver; + + public MacOSFactory() + { + NSApplication.Initialize(); + InputDriver = new HIDInput(); + } #region IPlatformFactory Members public override INativeWindow CreateNativeWindow(int x, int y, int width, int height, string title, GraphicsMode mode, GameWindowFlags options, DisplayDevice device) { - INativeWindow window = new CocoaNativeWindow(x, y, width, height, title, mode, options, device); - RegisterResource(window); - return window; + return new CocoaNativeWindow(x, y, width, height, title, mode, options, device); } public override IDisplayDeviceDriver CreateDisplayDeviceDriver() { - // Does not implement IDisposable return new QuartzDisplayDeviceDriver(); } public override IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags) { - IGraphicsContext context = new CocoaContext(mode, window, shareContext, major, minor); - RegisterResource(context); - return context; + return new CocoaContext(mode, window, shareContext, major, minor); } public override IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags) { - IGraphicsContext context = new CocoaContext(handle, window, shareContext, major, minor); - RegisterResource(context); - return context; + return new CocoaContext(handle, window, shareContext, major, minor); } public override GraphicsContext.GetCurrentContextDelegate CreateGetCurrentGraphicsContext()