Jump to content

  • Log In with Google      Sign In   
  • Create Account


SlimDX reading Texture2D to DataStream


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 wlastas   Members   -  Reputation: 100

Like
0Likes
Like

Posted 01 November 2011 - 12:06 PM

Device device = new Device( SharpDX.Direct3D10.DriverType.Hardware, DeviceCreationFlags.Debug);

    	ImageLoadInformation li = new ImageLoadInformation()

    	{

        	CpuAccessFlags = CpuAccessFlags.Read,

        	BindFlags = BindFlags.None,

        	MipLevels = 1,

        	Format = Format.R8G8B8A8_UNorm,

        	MipFilter = FilterFlags.None,

        	OptionFlags = ResourceOptionFlags.None,

        	Usage = ResourceUsage.Staging

    	};

    	Texture2D bitmap = Texture2D.FromFile<Texture2D>(device, @"N:\MI\bin\Maps\16x1.bmp", li);

    	DataRectangle dr =   bitmap.Map(0, MapMode.Read, MapFlags.None);

    	DataStream ds = new DataStream(dr.DataPointer, dr.Pitch * bitmap.Description.Height, true, true);



    	List<Byte4> b = new List<Byte4>();

    	while(ds.Position <ds.Length)

       	b.Add( ds.Read<Byte4>());


Sponsor:

#2 Mike.Popoloski   Crossbones+   -  Reputation: 2808

Like
0Likes
Like

Posted 01 November 2011 - 02:08 PM

Turn on the Direct3D debug runtimes and see if it gives you any debugging information about the error.
Mike Popoloski | Journal | SlimDX




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS