예제 #1
0
    // LatencyTest
    void LatencyTest(RenderTexture dest)
    {
        byte r = 0, g = 0, b = 0;

        // See if we get a string back to send to the debug out
        string s = Marshal.PtrToStringAnsi(OVRDeviceImposter.GetLatencyResultsString());

        if (s != null)
        {
            string result =
                "\n\n---------------------\nLATENCY TEST RESULTS:\n---------------------\n";
            result += s;
            result += "\n\n\n";
            print(result);
        }

        if (OVRDeviceImposter.DisplayLatencyScreenColor(ref r, ref g, ref b) == false)
        {
            return;
        }

        Debug.Log(r + " " + g + " " + b);

        RenderTexture.active = dest;
        Material material = ColorOnlyMaterial;

        QuadColor.r = (float)r / 255.0f;
        QuadColor.g = (float)g / 255.0f;
        QuadColor.b = (float)b / 255.0f;
        material.SetColor("_Color", QuadColor);
        GL.PushMatrix();
        material.SetPass(0);
        GL.LoadOrtho();
        GL.Begin(GL.QUADS);
        GL.Vertex3(0.3f, 0.3f, 0);
        GL.Vertex3(0.3f, 0.7f, 0);
        GL.Vertex3(0.7f, 0.7f, 0);
        GL.Vertex3(0.7f, 0.3f, 0);
        GL.End();
        GL.PopMatrix();
    }