Sign in to follow this  
Jerry.Mouse

SlimDX Screenshot

Recommended Posts

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.
Edited by Jerry.Mouse

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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 ?  
Edited by Jerry.Mouse

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this