public static void Init() { lock (Toolkit.InitLock) { if (Toolkit.initialized) { return; } Toolkit.initialized = true; Configuration.Init(); Factory temp_4 = new Factory(); } }
/// <summary> /// Initializes OpenTK. This method is necessary only if you are using OpenTK /// alongside a different windowing toolkit (e.g. GTK#) and should be the very /// first method called by your application (i.e. calling this method should be /// the very first statement executed by the "Main" method). /// </summary> /// <remarks> /// Some windowing toolkits do not configure the underlying platform /// correctly or configure it in a way that is incompatible with OpenTK. /// Calling this method first ensures that OpenTK is given the chance to /// initialize itself and configure the platform correctly. /// </remarks> public static void Init() { lock (InitLock) { if (!initialized) { initialized = true; Configuration.Init(); // The actual initialization takes place in the platform-specific factory // constructors. new Platform.Factory(); } } }
/// <summary> /// Initializes OpenTK. This method is necessary only if you are using OpenTK /// alongside a different windowing toolkit (e.g. GTK#) and should be the very /// first method called by your application (i.e. calling this method should be /// the very first statement executed by the "Main" method). /// </summary> /// <remarks> /// Some windowing toolkits do not configure the underlying platform /// correctly or configure it in a way that is incompatible with OpenTK. /// Calling this method first ensures that OpenTK is given the chance to /// initialize itself and configure the platform correctly. /// </remarks> public static IDisposable Init() { lock (InitLock) { if (!initialized) { initialized = true; Configuration.Init(); // The actual initialization takes place in the platform-specific factory // constructors. platform_factory = new Platform.Factory(); AppDomain.CurrentDomain.DomainUnload += Deinit; } return(platform_factory); } }
/// <summary> /// Initializes OpenTK with the specified options. Use this method /// to influence the OpenTK.Platform implementation that will be used. /// </summary> /// <remarks> /// <para> /// You *must* call this method if you are combining OpenTK with a /// third-party windowing toolkit (e.g. GTK#). In this case, this should be the /// first method called by your application: /// <code> /// static void Main() /// { /// using (OpenTK.Toolkit.Init()) /// { /// ... /// } /// } /// </code> /// </para> /// <para> /// The reason is that some toolkits do not configure the underlying platform /// correctly or configure it in a way that is incompatible with OpenTK. /// Calling this method first ensures that OpenTK is given the chance to /// initialize itself and configure the platform correctly. /// </para> /// </remarks> /// <param name="options">A <c>ToolkitOptions</c> instance /// containing the desired options.</param> /// <returns> /// An IDisposable instance that you can use to dispose of the resources /// consumed by OpenTK. /// </returns> public static Toolkit Init(ToolkitOptions options) { if (options == null) { throw new ArgumentNullException("options"); } lock (InitLock) { if (!initialized) { initialized = true; Configuration.Init(options); Options = options; // The actual initialization takes place in the // platform-specific factory constructors. toolkit = new Toolkit(new Factory()); } return(toolkit); } }