Beispiel #1
0
        /// <summary>
        /// Immediately binds a framebuffer to the OpenGL context and updates the state cache.
        /// </summary>
        /// <param name="framebuffer">The framebuffer to bind to the OpenGL context.</param>
        public static void BindFramebuffer(UInt32 framebuffer)
        {
            gl.BindFramebuffer(gl.GL_FRAMEBUFFER, framebuffer);
            gl.ThrowIfError();

            GL_FRAMEBUFFER_BINDING.Update(framebuffer);
            VerifyCache();
        }
Beispiel #2
0
        /// <summary>
        /// Immediately creates a framebuffer and updates the state cache.
        /// </summary>
        /// <param name="framebuffer">The identifier of the framebuffer that was created.</param>
        public static void CreateFramebuffer(out UInt32 framebuffer)
        {
            if (SupportsDirectStateAccessCreateFunctions)
            {
                framebuffer = gl.CreateFramebuffer();
                gl.ThrowIfError();
            }
            else
            {
                framebuffer = gl.GenFramebuffer();
                gl.ThrowIfError();

                if (!gl.IsDirectStateAccessAvailable)
                {
                    gl.BindFramebuffer(gl.GL_FRAMEBUFFER, framebuffer);
                    gl.ThrowIfError();

                    GL_FRAMEBUFFER_BINDING.Update(framebuffer);
                    VerifyCache();
                }
            }
        }