public override void Render() { Framebuffer.BindWithDrawBuffers(Framebuffer); GL.Enable(EnableCap.DepthTest); var shader = Resources.Find <Shader>("Debug"); Shader.SetShader(shader); //CameraLoop /*foreach(var cameraEntity in renderFrame.World.ReadEntities()) { * if(!cameraEntity.Has<Camera>()) { * continue; * } * * var camera = cameraEntity.Get<Camera>(); * var viewport = GetViewport(camera); * * GL.Viewport(viewport.x, viewport.y, viewport.width, viewport.height); * * var viewProj = camera.ViewMatrix * camera.ProjectionMatrix; * * Shader.UniformMatrix4(shader.GetUniformLocation("viewProj"), ref viewProj); * * Debug.FlushRendering(); * }*/ Shader.SetShader(null); GL.Disable(EnableCap.DepthTest); Framebuffer.Bind(null); }
private static void ParseJsonFramebuffers(Json jsonSettings, List <Framebuffer> framebuffers) { //Framebuffers foreach (var fbPair in jsonSettings.framebuffers) { string fbName = fbPair.Key; var fb = fbPair.Value; var framebuffer = Framebuffer.Create(fbName); Framebuffer.Bind(framebuffer); foreach (var texPair in fb.textures) { //bool noWrite = false; string texName = texPair.Key; var tex = texPair.Value; switch (tex.type) { case TextureAttachmentType.Color: break; case TextureAttachmentType.Depth: //noWrite = true; break; case TextureAttachmentType.DepthStencil: { framebuffer.AttachRenderbuffer(new Renderbuffer(texName, RenderbufferStorage.Depth24Stencil8), FramebufferAttachment.DepthStencilAttachment); continue; } default: throw new NotImplementedException(); } framebuffer.AttachRenderTexture(new RenderTexture(texName, Screen.Width, Screen.Height, textureFormat: tex.format)); Rendering.CheckFramebufferStatus(); } framebuffers.Add(framebuffer); } }