// Called by camera to apply image effect void OnRenderImage(RenderTexture source, RenderTexture destination) { if (isOn == false) { NImageEffects.BlitWithMaterial(material, source, destination); } }
public static void BlitWithMaterial(Material material, RenderTexture source, RenderTexture destination) { RenderTexture.active = destination; material.SetTexture("_MainTex", source); GL.PushMatrix(); GL.LoadOrtho(); for (int i = 0; i < material.passCount; i++) { material.SetPass(i); NImageEffects.DrawQuad(); } GL.PopMatrix(); }