OpenTK.GLControl.MakeCurrent C# (CSharp) Method

MakeCurrent() public method

Makes the underlying this GLControl current in the calling thread. All OpenGL commands issued are hereafter interpreted by this GLControl.
public MakeCurrent ( ) : void
return void
        public void MakeCurrent()
        {
            ValidateState();
            Context.MakeCurrent(Implementation.WindowInfo);
        }

Usage Example

        public static void InitializeSharedResources()
        {
            // Only setup once. This is checked multiple times to prevent crashes.
            if (setupStatus == SharedResourceStatus.Initialized)
            {
                return;
            }

            try
            {
                // Make a permanent context to share resources.
                GraphicsContext.ShareContexts = true;
                var control = new OpenTK.GLControl();
                control.MakeCurrent();

                RenderTools.LoadTextures();
                GetOpenGLSystemInfo();
                ShaderTools.SetUpShaders();

                setupStatus = SharedResourceStatus.Initialized;
            }
            catch (AccessViolationException)
            {
                // Context creation failed.
                setupStatus = SharedResourceStatus.Failed;
            }
        }
All Usage Examples Of OpenTK.GLControl::MakeCurrent