Generation

generate functionMon, 27 Feb 2023

Video capture of desktop to stream

void Start() { webCamTexture = new WebCamTexture(); webCamTexture.Play(); Debug.Log("Camera width: " + webCamTexture.width); Debug.Log("Camera height: " + webCamTexture.height); renderer.material.mainTexture = webCamTexture; _webCamTextureToMatHelper = gameObject.GetComponent<WebCamTextureToMatHelper>(); _webCamTextureToMatHelper.Initialize(); } void Update() { if (_webCamTextureToMatHelper.IsPlaying() && _webCamTextureToMatHelper.DidUpdateThisFrame()) { Mat rgbaMat = _webCamTextureToMatHelper.GetMat(); _texture = new Texture2D(rgbaMat.cols(), rgbaMat.rows(), TextureFormat.RGBA32, false); Utils.matToTexture2D(rgbaMat, _texture); } Texture2D tex = new Texture2D(webCamTexture.width, webCamTexture.height); tex.

Questions about programming?Chat with your personal AI assistant