public RenderTexture(int width, int height) { unityTexture = new UnityEngine.RenderTexture(width, height, 0); unityTexture.Create(); size.Width = width; size.Height = height; uvRect = new Rectangle(0, 0, 1, 1); }
public void CreateAndDeleteVideoTrack() { var context = Context.Create(); var width = 256; var height = 256; var format = WebRTC.GetSupportedRenderTextureFormat(UnityEngine.SystemInfo.graphicsDeviceType); var rt = new UnityEngine.RenderTexture(width, height, 0, format); rt.Create(); var track = context.CreateVideoTrack("video", rt.GetNativeTexturePtr()); context.DeleteMediaStreamTrack(track); context.Dispose(); }
public void CreateAndDeleteVideoTrack() { var value = NativeMethods.GetHardwareEncoderSupport(); var context = Context.Create( encoderType: value ? EncoderType.Hardware : EncoderType.Software); var width = 256; var height = 256; var format = WebRTC.GetSupportedRenderTextureFormat(UnityEngine.SystemInfo.graphicsDeviceType); var rt = new UnityEngine.RenderTexture(width, height, 0, format); rt.Create(); var track = context.CreateVideoTrack("video"); context.DeleteMediaStreamTrack(track); context.Dispose(); UnityEngine.Object.DestroyImmediate(rt); }
public void CreateAndDeleteVideoTrack() { var context = Context.Create(); var width = 256; var height = 256; var format = WebRTC.GetSupportedRenderTextureFormat(UnityEngine.SystemInfo.graphicsDeviceType); var rt = new UnityEngine.RenderTexture(width, height, 0, format); rt.Create(); var source = context.CreateVideoTrackSource(); var track = context.CreateVideoTrack("video", source); context.DeleteRefPtr(track); context.DeleteRefPtr(source); context.Dispose(); UnityEngine.Object.DestroyImmediate(rt); }
private static IntPtr EnsureNativePointer(UnityEngine.Texture tex) { IntPtr nativeTexturePtr = tex.GetNativeTexturePtr(); if (nativeTexturePtr == IntPtr.Zero) { UnityEngine.RenderTexture renderTexture = tex as UnityEngine.RenderTexture; if (renderTexture != null) { renderTexture.Create(); } nativeTexturePtr = tex.GetNativeTexturePtr(); if (nativeTexturePtr == IntPtr.Zero) { throw new System.Exception("Can't create TextureSource, texture native pointer is null"); } } return(nativeTexturePtr); }
static int _m_Create(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.RenderTexture __cl_gen_to_be_invoked = (UnityEngine.RenderTexture)translator.FastGetCSObj(L, 1); try { { bool __cl_gen_ret = __cl_gen_to_be_invoked.Create( ); LuaAPI.lua_pushboolean(L, __cl_gen_ret); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }