public void Begin() { _prevFbo = _fbos[0]; _prevFbo.Bind(); GL.Clear(ClearBufferMask.ColorBufferBit); _currentIndex = 1;//reset to 1 GL.Viewport(0, 0, Width, Heigth); }
public void Process() { foreach (var postProcess in _postProcesses) { var fbo = _fbos[_currentIndex]; fbo.Bind(); postProcess.Value.PrevFrameBuffer = _prevFbo; postProcess.Value.Process(); _prevFbo = fbo; _currentIndex = (_currentIndex + 1) % _fbos.Length; } }
public void Resize(int w, int h) { int sample = 1 << PlayerSetting.SsaaLevel; Width = w * sample; Heigth = h * sample; Log.Debug($"Window resize ({w}x{h}) -> ({Width}x{Heigth})"); for (int i = 0; i < _fbos.Length; i++) { _fbos[i]?.Dispose(); _fbos[i] = new PostProcessFrameBuffer(Width, Heigth); } foreach (var process in _postProcesses) { process.Value.OnResize(); } }