/// <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); }
/// <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); }