Esempio n. 1
0
        public void SetDataPointerEXT(
            int level,
            int left,
            int top,
            int right,
            int bottom,
            int front,
            int back,
            IntPtr data,
            int dataLength
            )
        {
            if (data == IntPtr.Zero)
            {
                throw new ArgumentNullException("data");
            }

            FNA3D.FNA3D_SetTextureData3D(
                GraphicsDevice.GLDevice,
                texture,
                left,
                top,
                front,
                right - left,
                bottom - top,
                back - front,
                level,
                data,
                dataLength
                );
        }
Esempio n. 2
0
        public void SetData <T>(
            int level,
            int left,
            int top,
            int right,
            int bottom,
            int front,
            int back,
            T[] data,
            int startIndex,
            int elementCount
            ) where T : struct
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            int      elementSizeInBytes = Marshal.SizeOf(typeof(T));
            GCHandle handle             = GCHandle.Alloc(data, GCHandleType.Pinned);

            FNA3D.FNA3D_SetTextureData3D(
                GraphicsDevice.GLDevice,
                texture,
                left,
                top,
                front,
                right - left,
                bottom - top,
                back - front,
                level,
                handle.AddrOfPinnedObject() + startIndex * elementSizeInBytes,
                elementCount * elementSizeInBytes
                );
            handle.Free();
        }