I try creating a shadow map in SlimDX using this tutorial
http://takinginitiat...shadow-mapping/
Whenever I create Texture2D for the shadow map I get System.NullReferenceException.
The relevant part of the code is here
Texture2DDescription shadowMapTexDesc = new Texture2DDescription()
{
Width = form.ClientSize.Width,
Height = form.ClientSize.Height,
MipLevels = 1,
ArraySize = 1,
Format = Format.R32_Typeless,
SampleDescription = swapDesc.SampleDescription,
Usage = ResourceUsage.Default,
BindFlags = BindFlags.DepthStencil | BindFlags.ShaderResource,
CpuAccessFlags = CpuAccessFlags.None,
OptionFlags = ResourceOptionFlags.None
};
shadowMap = new Texture2D(device, shadowMapTexDesc); // the exception is raised here
Anybody knows what I'm doing wrong?I'm using DirectX11.
Ryvola






