Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Member Since 19 Mar 2014
Offline Last Active Today, 04:53 AM

Posts I've Made

In Topic: SlimDx - ResolveSubresource

25 November 2014 - 12:51 AM

I have almost identical code using SharpDX (and previously worked with SlimDX), everything you are doing looks ok. The only differences I have here are that I am always passing 0 as the source and dest index (I'm not sure whether what you have would be coming through as 0 or not), and I have no need to bind to the pipeline so it has no BindFlags. Here is the example in case it helps:

// texture is multi-sampled, lets resolve it down to single sample
textureResolved = new Texture2D(texture.Device, new Texture2DDescription()
	CpuAccessFlags = CpuAccessFlags.None,
	Format = texture.Description.Format,
	Height = texture.Description.Height,
	Usage = ResourceUsage.Default,
	Width = texture.Description.Width,
	ArraySize = 1,
	SampleDescription = new SharpDX.DXGI.SampleDescription(1, 0), // Ensure single sample
	BindFlags = BindFlags.None,
	MipLevels = 1,
	OptionFlags = texture.Description.OptionFlags
// Resolve into textureResolved
texture.Device.ResolveSubresource(texture, 0, textureResolved, 0, texture.Description.Format);

In Topic: SlimDX to take Fullscreen Game-Screenshots

01 November 2014 - 06:21 PM

MemoryStream ms = new MemoryStream(screenshot.CapturedBitmap);
                            Image i = Image.FromStream(ms);


Just make sure you wrap these in using blocks otherwise you will leak memory (if doing lots of screenshots).

using (...) { }

In Topic: SlimDX to take Fullscreen Game-Screenshots

01 November 2014 - 12:46 AM

You don't have to detach. I'm using that version on Win8 fine. Saving to PNG is really easy, just save the Bitmap object to file and provide the correct format etc, instead of passing to the picturebox.

In Topic: SlimDX to take Fullscreen Game-Screenshots

30 October 2014 - 09:14 PM

The error appears to be within the overlay (from the screenshot), try without enabling the overlay.

In Topic: SlimDX to take Fullscreen Game-Screenshots

30 October 2014 - 12:53 AM

To capture images from a fullscreen Direct3D application you require access to the underlying Direct3D device and depending upon your approach you may need to hook into the Direct3D methods. To do this you usually would need to perform some form of code injection into the target application.


I've played around with this for a few years in C# with both SlimDX and SharpDX. You can find a discussion on "Screen capture and overlays for Direct3D 9, 10 and 11 using API hooks" on my blog, and the Direct3DHook project on GitHub.  I now use SharpDX exclusively (its a bit faster, lighter weight and easier to distribute), but you can fairly easily convert to use SlimDX (or use the old link to code on the blog post - although I recommend only using the linked zip for reference as many issues have since been addressed). There is some other relevant information in an older post on my blog, this also describes an alternative approach to hooking using interface wrapping.


The Direct3DHook project uses EasyHook to inject managed C# assemblies into the target process and to hook the necessary Direct3D functions.


NOTE: SharpDX only works with C# not VB.NET - so if VB is essential you will need to stay with SlimDX.


EDIT: lol just reread that code and noticed it is a translation to VB from one of my earlier projects :)