SlimDX Screenshot

Started by
3 comments, last by Jerry.Mouse 9 years, 9 months ago

Hello,

I have problem with SlimDX screenshot: This code

SlimDX::Direct3D9::DisplayMode displayMode = g_device3D->GetDisplayMode( 0 );
SlimDX::Direct3D9::Surface^ surface = nullptr;
surface = SlimDX::Direct3D9::Surface::CreateOffscreenPlain( g_device3D,
displayMode.Width,
displayMode.Height,
displayMode.Format, //
SlimDX::Direct3D9::Pool::SystemMemory );
g_device3D->GetFrontBufferData( 0, surface ); // ERROR is HERE
SlimDX::Direct3D9::Surface::ToFile( surface, fileName, SlimDX::Direct3D9::ImageFileFormat::Bmp );
gives me Error: D3DERR_INVALIDCALL: Invalid call (-2005530516). If I use Pool::Managed, the situation is identical.
can anyone help ?

all pointers (i.e. displayMode, g_device3D, surface ) are OK. If I use this code: - a small modification - everrything is OK

SlimDX::Direct3D9::DisplayMode displayMode = g_device3D->GetDisplayMode( 0 );
SlimDX::Direct3D9::Surface^ surface = nullptr;
surface = SlimDX::Direct3D9::Surface::CreateOffscreenPlain( g_device3D,
displayMode.Width,
displayMode.Height,
displayMode.Format, //
SlimDX::Direct3D9::Pool::SystemMemory );
// g_device3D->GetFrontBufferData( 0, surface );
surface = g_device3D->GetBackBuffer( 0, 0 ) ; //
SlimDX::Direct3D9::Surface::ToFile( surface, fileName, SlimDX::Direct3D9::ImageFileFormat::Bmp );
it is very suspicious.
Advertisement

There's really not enough information here, and it looks like you're not doing any error checking either (unless, of course, you've just simplified the code for posting)...

Does CreateOffscreenPlain succeed and give you a valid pointer? Or does it generate an error?

Is g_device3D a valid pointer to an initialized D3D::Device you've created?

all pointers (i.e. displayMode, g_device3D, surface ) are OK. If I use this code: - a small modification - everrything is OK

SlimDX::Direct3D9::DisplayMode displayMode = g_device3D->GetDisplayMode( 0 );
SlimDX::Direct3D9::Surface^ surface = nullptr;
surface = SlimDX::Direct3D9::Surface::CreateOffscreenPlain( g_device3D,
displayMode.Width,
displayMode.Height,
displayMode.Format, //
SlimDX::Direct3D9::Pool::SystemMemory );
// g_device3D->GetFrontBufferData( 0, surface );
surface = g_device3D->GetBackBuffer( 0, 0 ) ; //
SlimDX::Direct3D9::Surface::ToFile( surface, fileName, SlimDX::Direct3D9::ImageFileFormat::Bmp );
it is very suspicious.
What is (-2005530516) hexa: FFFFFFFF8876086C error ?
SlimDX::Direct3D9::DisplayMode displayMode = g_device3D->GetDisplayMode( 0 ); SlimDX::Direct3D9::Surface^ surface = nullptr; surface = SlimDX::Direct3D9::Surface::CreateOffscreenPlain( g_device3D, displayMode.Width, displayMode.Height, displayMode.Format, // SlimDX::Direct3D9::Pool::SystemMemory ); // g_device3D->GetFrontBufferData( 0, surface ); You are possible interpreted cho Minh segments of this is not, Thank many

Im afraid, I do not understand to this sentence:

"You are possible interpreted cho Minh segments of this is not, Thank many...."

What ? blink.png

I need to get front buffer data but I do not know how...

This topic is closed to new replies.

Advertisement