isolating glow fx so only some objects gets the glow based on alpha

So I’m trying to make the post glow fx only on a few objects. I know it’s using the alpha to control what gets glow but since I have transparent objects in my scene I can’t have all the objects as alpha=0 so here’s what I had in mind for solution.
in the glowEffect script add the following onPostRender function that will first write out all the alpha in the scene as 0, then render the objects that needs to glow as alpha=1.

void OnPostRender()
{
// Draw a quad over the whole screen with the above shader
GL.PushMatrix ();
GL.LoadOrtho ();
for (int j = 0; j < matAlpha0.passCount; ++j) {
matAlpha0.SetPass (j);
GL.Begin( GL.QUADS );
GL.Vertex3( 0f, 0f, 0.1f );
GL.Vertex3( 1f, 0f, 0.1f );
GL.Vertex3( 1f, 1f, 0.1f );
GL.Vertex3( 0f, 1f, 0.1f );
GL.End();
}
GL.PopMatrix ();

// render alpha 1
if(glowTag != “”)
{
alpha0Material.color = new Color(1f,1f,1f,1f);
GameObject[ ] gos = GameObject.FindGameObjectsWithTag(glowTag);
for (int i=0; i < gos.Length ; i++)
{
GameObject go = gos*;*

  • if(go.GetComponent())*
  • {*
  • MeshFilter mf = go.GetComponent();*
  • Mesh mesh = mf.sharedMesh;*
  • Graphics.DrawMesh(mesh,go.transform.localToWorldMatrix,matAlpha1,0,camera);*
  • }*
  • } *
  • } *
  • }*
    matAlpha0 is the material that will write alpha 0, and matAlpha1 should write alpha 1.
    The problem that I’m having is in the zDepth, since the plane is in front of the camera and it write alpha 0 over my other objects.
    Any suggestion how to do that?

Got it to work.
I replaced the Graphics.DrawMesh with Graphics.DrawMeshNow