daily pastebin goal
7%
SHARE
TWEET

FullScreenQuad.cs

Bunny83 Mar 13th, 2018 15 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top