public static FramebufferInfo CreateFramebuffer(this IOSurface surface) { var size = surface.Size.Max(1, 1); var handles = new int[1]; GL.GenFramebuffers(1, handles); var handle = new FramebufferHandle(handles[0]); GL.BindFramebuffer(FramebufferTarget.Framebuffer, handle); var depthbuffer = CreateDepthBuffer(size); GL.FramebufferRenderbuffer(FramebufferTarget.Framebuffer, FramebufferAttachment.DepthAttachment, RenderbufferTarget.Renderbuffer, depthbuffer); var colorbuffer = IOSurfaceTexture.Create(size, surface); GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, TextureTarget.TextureRectangle, colorbuffer, 0); CheckStatus(); return(new FramebufferInfo(handle, depthbuffer, Optional.None(), colorbuffer)); }
public static TextureHandle CreateTexture(this IOSurface surface) { return(IOSurfaceTexture.Create(surface.Size, surface)); }