public GlTexture CreateDestinationTexture(int width, int height, GpuBufferFormat format)
        {
            UnsafeNativeMethods.mp_GlCalculatorHelper__CreateDestinationTexture__i_i_ui(mpPtr, width, height, format, out var texturePtr).Assert();

            GC.KeepAlive(this);
            return(new GlTexture(texturePtr));
        }
Beispiel #2
0
        public GlTextureBuffer(UInt32 target, UInt32 name, int width, int height,
                               GpuBufferFormat format, DeletionCallback callback, MpGlContext glContext)
        {
            deletionCallbackHandle = GCHandle.Alloc(callback, GCHandleType.Pinned);
            ptr = UnsafeNativeMethods.MpGlTextureBufferCreate(
                target, name, width, height, (UInt32)format, Marshal.GetFunctionPointerForDelegate(callback), glContext);

            base.TakeOwnership(ptr);
        }
        public static GlTextureInfo GlTextureInfoFor(this GpuBufferFormat gpuBufferFormat, int plane)
        {
            var ptr  = UnsafeNativeMethods.MpGlTextureInfoForGpuBufferFormat((UInt32)gpuBufferFormat, plane);
            var info = Marshal.PtrToStructure <GlTextureInfo>(ptr);

            UnsafeNativeMethods.MpGlTextureInfoDestroy(ptr);

            return(info);
        }
        public static GlTextureInfo GlTextureInfoFor(this GpuBufferFormat gpuBufferFormat, int plane, GlVersion glVersion = GlVersion.kGLES3)
        {
            UnsafeNativeMethods.mp__GlTextureInfoForGpuBufferFormat__ui_i_ui(gpuBufferFormat, plane, glVersion, out var glTextureInfoPtr);
            var glTextureInfo = Marshal.PtrToStructure <GlTextureInfo>(glTextureInfoPtr);

            UnsafeNativeMethods.mp_GlTextureInfo__delete(glTextureInfoPtr);

            return(glTextureInfo);
        }
Beispiel #5
0
        /// <param name="callback">
        ///   A function called when the texture buffer is deleted.
        ///   Make sure that this function doesn't throw exceptions and won't be GCed.
        /// </param>
        public GlTextureBuffer(UInt32 target, UInt32 name, int width, int height,
                               GpuBufferFormat format, DeletionCallback callback, GlContext glContext)
        {
            var sharedContextPtr = glContext == null ? IntPtr.Zero : glContext.sharedPtr;

            UnsafeNativeMethods.mp_SharedGlTextureBuffer__ui_ui_i_i_ui_PF_PSgc(
                target, name, width, height, format, callback, sharedContextPtr, out var ptr).Assert();

            sharedPtrHandle = new SharedPtr(ptr);
            this.ptr        = sharedPtrHandle.Get();
        }
 public static extern MpReturnCode mp_GlCalculatorHelper__CreateDestinationTexture__i_i_ui(
     IntPtr glCalculatorHelper, int outputWidth, int outputHeight, GpuBufferFormat formatCode, out IntPtr glTexture);
Beispiel #7
0
 public static GlTextureInfo GlTextureInfoFor(this GpuBufferFormat gpuBufferFormat, int plane, GlVersion glVersion = GlVersion.kGLES3)
 {
     UnsafeNativeMethods.mp__GlTextureInfoForGpuBufferFormat__ui_i_ui(gpuBufferFormat, plane, glVersion, out var glTextureInfo).Assert();
     return(glTextureInfo);
 }
Beispiel #8
0
 public static ImageFormat.Format ImageFormatFor(this GpuBufferFormat gpuBufferFormat)
 {
     return(SafeNativeMethods.mp__ImageFormatForGpuBufferFormat__ui(gpuBufferFormat));
 }
Beispiel #9
0
 public static extern MpReturnCode mp__GlTextureInfoForGpuBufferFormat__ui_i_ui(
     GpuBufferFormat format, int plane, GlVersion glVersion, out GlTextureInfo glTextureInfo);
Beispiel #10
0
 public GlTextureBuffer(UInt32 name, int width, int height, GpuBufferFormat format, DeletionCallback callback, GlContext glContext = null) :
     this(Gl.GL_TEXTURE_2D, name, width, height, format, callback, glContext)
 {
 }
 public static extern MpReturnCode mp_SharedGlTextureBuffer__ui_ui_i_i_ui_PF_PSgc(
     UInt32 target, UInt32 name, int width, int height, GpuBufferFormat format,
     [MarshalAs(UnmanagedType.FunctionPtr)] GlTextureBuffer.DeletionCallback deletionCallback,
     IntPtr producerContext, out IntPtr sharedGlTextureBuffer);
Beispiel #12
0
 public static extern ImageFormat.Format mp__ImageFormatForGpuBufferFormat__ui(GpuBufferFormat format);
Beispiel #13
0
 public GlTextureBuffer(UInt32 name, int width, int height, GpuBufferFormat format, DeletionCallback callback) :
     this(name, width, height, format, callback, IntPtr.Zero)
 {
 }
 public static ImageFormat ImageFormatFor(this GpuBufferFormat gpuBufferFormat)
 {
     return((ImageFormat)UnsafeNativeMethods.MpImageFormatForGpuBufferFormat((UInt32)gpuBufferFormat));
 }
 public static GlTextureInfo GlTextureInfoFor(this GpuBufferFormat gpuBufferFormat, int plane)
 {
     return(new GlTextureInfo(UnsafeNativeMethods.MpGlTextureInfoForGpuBufferFormat((UInt32)gpuBufferFormat, plane)));
 }