- Home /
Question by
mhernandez88 · Mar 28, 2017 at 07:15 AM ·
meshgraphicsdrawcallsosx
Graphics.DrawMeshNow ( Does it work on OSX Capitan )
Thank you in advance. Other Useful Stats: Graphics Card: Intel Iris Pro 1536 MB
Problem: I am having an insane amount of trouble getting a trivial example of Graphics.DrawMeshNow working. I need to know if its functioning properly as it seems to be breaking a 3rd party library.
So for the trivial example, I have referenced several posts, this one standing out (http://answers.unity3d.com/questions/41550/drawing-a-screen-space-rectangle-with-graphicsdraw.html).
I have transformed that code into
void OnPostRender() {
Material material = new Material( Shader.Find("Standard") );
Mesh quad = Sp;
// 5. Set material:
material.SetPass(0);
Debug.Log ("Drawing Now");
// 6. Draw now:
// UnityEngine.Graphics.DrawMeshNow(quad,UnityEngine.Matrix4x4.identity);
UnityEngine.Graphics.DrawMeshNow(quad,Camera.current.transform.position, Camera.current.transform.rotation);
}
private Mesh Sp{
get{
Mesh mesh=new Mesh();
Vector3[] vertices = new Vector3[4];
vertices[0] = new Vector3(-1f, -1f, Camera.current.nearClipPlane);
vertices[1] = new Vector3(-1f, 1f, Camera.current.nearClipPlane);
vertices[2] = new Vector3(1f, 1f, Camera.current.nearClipPlane);
vertices[3] = new Vector3(1f, -1f, Camera.current.nearClipPlane);
for (int i = 0; i < 4; i++)
{
vertices[i] = Camera.current.ViewportToWorldPoint(vertices[i]);
}
mesh.vertices = vertices;
return mesh;
}
}
Adding in triangles does nothing either.
mesh.triangles=new int[]{ %|-1051048334_27|% %|1606085734_28|%
Using mesh.UploadMeshData (true); does nothing either :( mesh.UploadMeshData (true);
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612113926im_/https://answers.unity.com/themes/thub/images/avi.jpg)