예제 #1
1
        /// <summary>
        ///   Initializes a new instance of the <see cref = "T:SharpDX.Direct3D10.Texture2D" /> class.
        /// </summary>
        /// <param name = "device">The device with which to associate the texture.</param>
        /// <param name = "description">The description of the texture.</param>
        /// <param name = "data">An array of initial texture data for each subresource.</param>
        public Texture2D(Device device, Texture2DDescription description, DataRectangle[] data)
            : base(IntPtr.Zero)
        {
            DataBox[] subResourceDatas = null;

            if (data != null)
            {
                subResourceDatas = new DataBox[data.Length];
                for (int i = 0; i < subResourceDatas.Length; i++)
                {
                    subResourceDatas[i].DataPointer = data[i].DataPointer;
                    subResourceDatas[i].RowPitch = data[i].Pitch;
                }
            }
            device.CreateTexture2D(ref description, subResourceDatas, this);
        }
예제 #2
0
 /// <summary>
 ///   Initializes a new instance of the <see cref = "T:SharpDX.Direct3D10.Texture2D" /> class.
 /// </summary>
 /// <param name = "device">The device with which to associate the texture.</param>
 /// <param name = "description">The description of the texture.</param>
 public Texture2D(Device device, Texture2DDescription description)
     : base(IntPtr.Zero)
 {
     device.CreateTexture2D(ref description, null, this);
 }