public void InitHandler() { // create the background texture (size 1x1, can be scaled to any size) mBackgroundTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false); mBackgroundTexture.SetPixel(0, 0, new Color(0f, 0f, 0f, mBackgroundAlpha)); mBackgroundTexture.Apply(false); // create the texture for bounding boxes mBoundingBoxTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false); mBoundingBoxTexture.SetPixel(0, 0, mBBoxColor); mBoundingBoxTexture.Apply(false); mBoundingBoxMaterial = new Material(boundingBoxMaterial); mBoundingBoxMaterial.SetTexture("_MainTex", mBoundingBoxTexture); mWordStyle = new GUIStyle(); mWordStyle.normal.textColor = Color.white; mWordStyle.alignment = TextAnchor.UpperCenter; mWordStyle.font = Resources.Load("SourceSansPro-Regular_big") as Font; mIsTablet = IsTablet(); if (QCARRuntimeUtilities.IsPlayMode()) { mIsTablet = false; } if (mIsTablet) { mLoupeWidth = 0.6f; mLoupeHeight = 0.1f; mTextboxWidth = 0.6f; mFixedWordCount = 14; } // register to TextReco events var trBehaviour = GetComponent <TextRecoBehaviour>(); if (trBehaviour) { trBehaviour.RegisterTextRecoEventHandler(this); } // register for the OnVideoBackgroundConfigChanged event at the QCARBehaviour QCARBehaviour qcarBehaviour = (QCARBehaviour)FindObjectOfType(typeof(QCARBehaviour)); if (qcarBehaviour) { qcarBehaviour.RegisterVideoBgEventHandler(this); } }
public void InitBehaviour() { // register for the OnVideoBackgroundConfigChanged event at the QCARBehaviour QCARBehaviour qcarBehaviour = (QCARBehaviour)FindObjectOfType(typeof(QCARBehaviour)); if (qcarBehaviour) { qcarBehaviour.RegisterVideoBgEventHandler(this); } // Use the main camera if one wasn't set in the Inspector if (m_Camera == null) { m_Camera = Camera.main; } // Ask the renderer to stop drawing the videobackground. QCARRenderer.Instance.DrawVideoBackground = false; }