using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace StgSharp.Graphics.GL { #pragma warning disable CA1008 #pragma warning disable CA1028 public enum FrameBufferTarget:uint #pragma warning restore CA1028 #pragma warning restore CA1008 { Read = GLconst.READ_FRAMEBUFFER, All = GLconst.FRAMEBUFFER, Draw = GLconst.DRAW_FRAMEBUFFER, } public class FrameBuffer : BufferObjectBase { internal unsafe FrameBuffer(int count, glRenderStream contextBinding) { binding = contextBinding; _bufferHandle = new glHandleSet(count); ((GLcontext*)binding.ContextHandle)->glGenFramebuffers((uint)count,_bufferHandle.handle); } /// /// Bind the frame buffer object with name frame buffer to the frame buffer target specified by target. /// will be set as default target. /// /// Index of object to be binded in handle set public unsafe override void Bind(int index) { glFunc.BindFrameBuffer(FrameBufferTarget.All,_bufferHandle[index]); } public static void BindNull() { glFunc.BindFrameBuffer(FrameBufferTarget.All,glHandle.Zero); } /// /// Bind the frame buffer object with name frame buffer to the frame buffer target specified by target. /// Target of this frame buffer should be set manually. /// /// The frame buffer target of the binding operation. /// Index of object to be binded in handle set public unsafe void Bind(FrameBufferTarget target, int index) { ((GLcontext*)binding.ContextHandle)->glBindFramebuffer((uint)target, _bufferHandle[index].Value); } protected override void Dispose(bool disposing) { throw new NotImplementedException(); } } }