예제 #1
0
        void Awake()
        {
            mainCam = GetComponent <Camera>();
            if (mainCam == null)
            {
                Debug.LogError("Can't find Camera!");
                DestroyImmediate(this);
                return;
            }

            //Enable these keywords to let the unity shaders works for single pass stereo rendering
            Shader.EnableKeyword("STEREO_MULTIVIEW_ON");
            Shader.EnableKeyword("UNITY_SINGLE_PASS_STEREO");

            //Texture2DArray could only be generated in runtime
            renderTexture = new Texture2DArray(1024, 1024, 2, TextureFormat.ARGB32, false);
            System.IntPtr tid = renderTexture.GetNativeTexturePtr();
            Debug.Log("Texture ID " + (int)tid);
            //Tell native plugin the texture id
            NativePlugin.SetTextureID((int)tid);
            NativePlugin.SetAntiAliasing(QualitySettings.antiAliasing);
        }