7     [RequireComponent (typeof(Camera))]
    12             Debug.Log(
"OnRenderImage in Helper called ...");
    17             RenderTexture source, RenderTexture dest ,
    19             Camera cameraForProjectionMatrix )
    22             RenderTexture.active = dest;
    24             material.SetTexture(
"_MainTex", source);
    29             GL.LoadProjectionMatrix(cameraForProjectionMatrix.projectionMatrix);
    31             float fovYHalfRad = cameraForProjectionMatrix.fieldOfView * 0.5f * Mathf.Deg2Rad;
    32             float cotangent = Mathf.Cos(fovYHalfRad) / Mathf.Sin(fovYHalfRad);
    33             float asp = cameraForProjectionMatrix.aspect;
    35             float x1 = asp/-cotangent;
    36             float x2 = asp/cotangent;
    37             float y1 = 1.0f/-cotangent;
    38             float y2 = 1.0f/cotangent;
    49             for (
int i = 0; i < material.passCount; i++)
    57                     y1_ = 1.0f; y2_ = 0.0f;
    61                     y1_ = 0.0f; y2_ = 1.0f;
    63                 GL.TexCoord2(0.0f, y1_); GL.Vertex3(x1, y1, z1);
    64                 GL.TexCoord2(1.0f, y1_); GL.Vertex3(x2, y1, z1);
    65                 GL.TexCoord2(1.0f, y2_); GL.Vertex3(x2, y2, z1);
    66                 GL.TexCoord2(0.0f, y2_); GL.Vertex3(x1, y2, z1);
    82             RenderTexture.active = dest;
    88             for (
int i = 0; i < material.passCount; i++)
    95                     y1_ = 1.0f; y2_ = 0.0f;
    99                     y1_ = 0.0f; y2_ = 1.0f;
   104                 x2 = 0.0f + 1.0f/(dest.width*1.0f);
   109                 GL.TexCoord2(0.0f, y1_); GL.Vertex3(x1, y1, 0.1f);
   110                 GL.TexCoord2(1.0f, y1_); GL.Vertex3(x2, y1, 0.1f);
   111                 GL.TexCoord2(1.0f, y2_); GL.Vertex3(x2, y2, 0.1f);
   112                 GL.TexCoord2(0.0f, y2_); GL.Vertex3(x1, y2, 0.1f);
   115                 x1 = 1.0f - 1.0f/(dest.width*1.0f);
   120                 GL.TexCoord2(0.0f, y1_); GL.Vertex3(x1, y1, 0.1f);
   121                 GL.TexCoord2(1.0f, y1_); GL.Vertex3(x2, y1, 0.1f);
   122                 GL.TexCoord2(1.0f, y2_); GL.Vertex3(x2, y2, 0.1f);
   123                 GL.TexCoord2(0.0f, y2_); GL.Vertex3(x1, y2, 0.1f);
   129                 y2 = 0.0f + 1.0f/(dest.height*1.0f);
   131                 GL.TexCoord2(0.0f, y1_); GL.Vertex3(x1, y1, 0.1f);
   132                 GL.TexCoord2(1.0f, y1_); GL.Vertex3(x2, y1, 0.1f);
   133                 GL.TexCoord2(1.0f, y2_); GL.Vertex3(x2, y2, 0.1f);
   134                 GL.TexCoord2(0.0f, y2_); GL.Vertex3(x1, y2, 0.1f);
   139                 y1 = 1.0f - 1.0f/(dest.height*1.0f);
   142                 GL.TexCoord2(0.0f, y1_); GL.Vertex3(x1, y1, 0.1f);
   143                 GL.TexCoord2(1.0f, y1_); GL.Vertex3(x2, y1, 0.1f);
   144                 GL.TexCoord2(1.0f, y2_); GL.Vertex3(x2, y2, 0.1f);
   145                 GL.TexCoord2(0.0f, y2_); GL.Vertex3(x1, y2, 0.1f);
   153         static void DrawLowLevelQuad (  
float x1, 
float x2, 
float y1, 
float y2, RenderTexture source, RenderTexture dest, Material material )
   156             RenderTexture.active = dest;
   158             material.SetTexture(
"_MainTex", source);
   164             for (
int i = 0; i < material.passCount; i++)
   169                 float y1_; 
float y2_;
   172                     y1_ = 1.0f; y2_ = 0.0f;
   176                     y1_ = 0.0f; y2_ = 1.0f;
   178                 GL.TexCoord2(0.0f, y1_); GL.Vertex3(x1, y1, 0.1f);
   179                 GL.TexCoord2(1.0f, y1_); GL.Vertex3(x2, y1, 0.1f);
   180                 GL.TexCoord2(1.0f, y2_); GL.Vertex3(x2, y2, 0.1f);
   181                 GL.TexCoord2(0.0f, y2_); GL.Vertex3(x1, y2, 0.1f);
 static void DrawBorder(RenderTexture dest, Material material)
 
static void DrawLowLevelPlaneAlignedWithCamera(float dist, RenderTexture source, RenderTexture dest, Material material, Camera cameraForProjectionMatrix)
 
void OnRenderImage(RenderTexture source, RenderTexture destination)
 
static void DrawLowLevelQuad(float x1, float x2, float y1, float y2, RenderTexture source, RenderTexture dest, Material material)