Advertisement
Bunny83

FullScreenQuad.cs

Mar 13th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1. // Attach this script to the camera
  2. using UnityEngine;
  3.  
  4. public class FullScreenQuad : MonoBehaviour
  5. {
  6.     public Material fullScreenStencilMat;
  7.  
  8.     private void OnPostRender()
  9.     {
  10.         fullScreenStencilMat.SetPass(0);
  11.         GL.PushMatrix();
  12.         GL.LoadPixelMatrix(0, 1, 0, 1);
  13.         GL.modelview = Matrix4x4.identity;
  14.         GL.Color(Color.white);
  15.         GL.Begin(GL.QUADS);
  16.         GL.Vertex3(0, 0, 0);
  17.         GL.Vertex3(0, 1, 0);
  18.         GL.Vertex3(1, 1, 0);
  19.         GL.Vertex3(1, 0, 0);
  20.         GL.End();
  21.         GL.PopMatrix();
  22.  
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement