public void copyFramebuffer(IFramebuffer source, IFramebuffer target, bool fromLowres) { //Bind shader LowLevelRenderer.shader = HighLevelRenderer.shaderDrawSprite; target.bind(); //Set target size uniforms var tmatrix = fromLowres ? Util.Maths.matrixFitRectIntoScreen(lowResWidth, lowResHeight, highResWidth, highResHeight) : Matrix4.Identity; HighLevelRenderer.shaderDrawSprite["transformMatrix"].SetValue(tmatrix); float yflip = fromLowres ? -1 : 1; HighLevelRenderer.shaderDrawSprite["uvMatrix"].SetValue(new Matrix4(new float[] {1,0,0,0, 0,yflip,0,0, 0,0,0,0, 0,0,0,1})); //Bind source texture Gl.BindTexture(TextureTarget.Texture2D, source.textures()[0]); LowLevelRenderer.geometry = LowLevelRenderer.quad; LowLevelRenderer.draw(); }