Use the cycle to draw both the front and back sides separately. I feel that there should be a way to draw both the front and back sides once. The main reason is that I haven't fully understood the GL part, so don't worry, take your time.
Code reference:
using UnityEngine;
using UnityEngine.Rendering;
public class GLWireFrame : MonoBehaviour
{
[SerializeField]
MeshFilter filter;
[SerializeField]
Material matFront;
[SerializeField]
Material matBack;
Vector3[] verts;
int[] tris;
private void Start()
{
verts = filter.mesh.vertices;
tris = filter.mesh.triangles;
}
void OnEnable()
{
RenderPipelineManager.endCameraRendering += EndCameraRendering;
}
void OnDisable()
{
RenderPipelineManager.endCameraRendering -= EndCameraRendering;
}
void EndCameraRendering(ScriptableRenderContext context, Camera camera)
{
float len = 10;
Vector3 p1, p2;
p1 = new Vector3(len * Mathf.Cos(Time.time), len * Mathf.Sin(Time.time), 0);
p2 = -p1;
GL.MultMatrix(transform.localToWorldMatrix);
GL.wireframe = true;
GL.Begin(GL.TRIANGLES);
matBack.SetPass(0);
for (int i = 0; i < tris.Length; i += 3)
{
GL.Vertex(verts[tris[i]]);
GL.Vertex(verts[tris[i + 2]]);
GL.Vertex(verts[tris[i + 1]]);
}
GL.End();
matFront.SetPass(0);
GL.Begin(GL.TRIANGLES);
for (int i = 0; i < tris.Length; i+=3)
{
GL.Vertex(verts[tris[i]]);
GL.Vertex(verts[tris[i +1]]);
GL.Vertex(verts[tris[i +2]]);
}
GL.End();
GL.wireframe = false;
}
}