Example #1
0
        /// <summary>
        /// Makes the context current on the calling thread.
        /// </summary>
        /// <param name="ctx">
        /// A <see cref="IntPtr"/> that specify the context to be current on the calling thread, bound to
        /// thise device context. It can be IntPtr.Zero indicating that no context will be current.
        /// </param>
        /// <returns>
        /// It returns a boolean value indicating whether the operation was successful.
        /// </returns>
        /// <exception cref="NotSupportedException">
        /// Exception thrown if the current platform is not supported.
        /// </exception>
        public virtual bool MakeCurrent(IntPtr ctx)
        {
            // Basic implementation
            bool current = MakeCurrentCore(ctx);

            // Link OpenGL procedures on Gl
            if (ctx == IntPtr.Zero || current != true)
            {
                return(current);
            }

            switch (DefaultAPI)
            {
            case KhronosVersion.ApiGlsc2:
                // Special OpenGL SC2 management: loads only SC2 requirements
                // Note: in order to work, DefaultAPI should stay set to SC2! Otherwise user shall call BindAPI manually
                Gl.BindAPI(Gl.Version_200_SC, null);
                break;

            default:
                Gl.BindAPI();
                break;
            }

            return(true);
        }
Example #2
0
        /// <summary>
        /// Makes the context current on the calling thread.
        /// </summary>
        /// <param name="ctx">
        /// A <see cref="IntPtr"/> that specify the context to be current on the calling thread, bound to
        /// thise device context. It can be IntPtr.Zero indicating that no context will be current.
        /// </param>
        /// <returns>
        /// It returns a boolean value indicating whether the operation was successful.
        /// </returns>
        /// <exception cref="NotSupportedException">
        /// Exception thrown if the current platform is not supported.
        /// </exception>
        public virtual bool MakeCurrent(IntPtr ctx)
        {
            // Basic implementation
            bool current = MakeCurrentCore(ctx);

            // Link OpenGL procedures on Gl
            if ((ctx != IntPtr.Zero) && (current == true))
            {
                Gl.BindAPI();
            }

            return(current);
        }
Example #3
0
        /// <summary>
        /// Makes the context current on the calling thread.
        /// </summary>
        /// <param name="ctx">
        /// A <see cref="IntPtr"/> that specify the context to be current on the calling thread, bound to
        /// thise device context. It can be IntPtr.Zero indicating that no context will be current.
        /// </param>
        /// <returns>
        /// It returns a boolean value indicating whether the operation was successful.
        /// </returns>
        /// <exception cref="NotSupportedException">
        /// Exception thrown if the current platform is not supported.
        /// </exception>
        public virtual bool MakeCurrent(IntPtr ctx)
        {
            // Basic implementation
            bool current = MakeCurrentCore(ctx);

            // Link OpenGL procedures on Gl
            if ((ctx != IntPtr.Zero) && (current == true))
            {
                switch (DefaultApi)
                {
                case KhronosVersion.ApiGlsc2:
                    // Special OpenGL SC2 management: loads only SC2 requirements
                    Gl.BindAPI(Gl.Version_200_SC, null);
                    break;

                default:
                    Gl.BindAPI();
                    break;
                }
            }

            return(current);
        }