protected override void OnRenderFrame(FrameEventArgs e) { _fbo.BindDraw(); //Utilities.CheckGLError(); GL.Viewport(0, 0, _fbo.Width, _fbo.Height); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); _graphicsDevice.World = _dwarfWorld; _graphicsDevice.Camera = _3DCamera; foreach (ModelMesh mesh in _dwarf.Meshes) { foreach (ModelMeshPart part in mesh.MeshParts) { _defferedShader.Bind(); _defferedShader.BindUniforms(part.Material.Passes[0].Parameters); _graphicsDevice.DrawVertexArray(part.VertexArray, _defferedShader); } } _fbo.Unbind(); _graphicsDevice.Camera = _screenCamera; _spriteBatch.Begin(); _spriteBatch.Draw(_diffuseTexture, 0, 0, _graphicsDevice.Width / 2, _graphicsDevice.Height / 2, effect: SpriteEffect.FlipVertically); _spriteBatch.Draw(_positionTexture, _graphicsDevice.Width / 2, 0, _graphicsDevice.Width / 2, _graphicsDevice.Height / 2, effect: SpriteEffect.FlipVertically); _spriteBatch.Draw(_normalTexture, 0, _graphicsDevice.Height / 2, _graphicsDevice.Width / 2, _graphicsDevice.Height / 2, effect: SpriteEffect.FlipVertically); _spriteBatch.Draw(_depthTexture, _graphicsDevice.Width / 2, _graphicsDevice.Height / 2, _graphicsDevice.Width / 2, _graphicsDevice.Height / 2, effect: SpriteEffect.FlipVertically); _spriteBatch.End(); _graphicsDevice.Camera = _3DCamera; _graphicsDevice.World = Matrix4.Identity; _graphicsDevice.DrawFPS(); _graphicsDevice.DrawStatitics(600, 0); _graphicsDevice.Display(e.Time); }