Sign in to follow this  
Alex Swinney

Having trouble with screen shot

Recommended Posts

Alex Swinney    236
http://www.gamedev.net/community/forums/topic.asp?topic_id=174289 http://www.gamedev.net/reference/articles/article1844.asp http://www.gamedev.net/community/forums/topic.asp?topic_id=102697 Those are the threads/article that I have referenced to get my screen shot to work. I actually did have it working. Then I modularized my code (went to OOP from proceduralistic approach), and now, it no work. Here is my code:
	string file = "screenshot.jpg";
	HRESULT hr;
	LPDIRECT3DSURFACE9 backBuf = 0;

	hr = this->device->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO, &backBuf);
	if (FAILED(hr))
		MessageBox(0,"couldn't get backbuffer",0,0);

	hr = D3DXSaveSurfaceToFile(file.c_str(),D3DXIFF_JPG,backBuf,NULL,NULL);
	if (FAILED(hr))
		MessageBox(0,"couldn't save backbuffer",0,0);
	backBuf->Release();

What is going wrong? I keep getting either a pink picture or a green picture. My shots are most definately not pink nor all green. Thanks!

Share this post


Link to post
Share on other sites
mdias    823
If you have the debug runtime of Direct3D activated, it will clear every new frame with green and magenta sequencially.
So, I'd guess that you're trying to get the backbuffer's content before rendering any visible polygons.

[edit] try switching your Direct3D runtime to Retail.
tto do that open your Control Panel and double click on the "DirectX" Icon. Then click on "Direct3D" tab and there it is.

Share this post


Link to post
Share on other sites
Alex Swinney    236
Quote:
Original post by Kamikaze15
If you have the debug runtime of Direct3D activated, it will clear every new frame with green and magenta sequencially.
So, I'd guess that you're trying to get the backbuffer's content before rendering any visible polygons.

[edit] try switching your Direct3D runtime to Retail.
tto do that open your Control Panel and double click on the "DirectX" Icon. Then click on "Direct3D" tab and there it is.


Thank you! That got it for me. The end-user doesn't have to worry about that, right?

Share this post


Link to post
Share on other sites
mdias    823
Quote:
Original post by Alex Swinney
Thank you! That got it for me. The end-user doesn't have to worry about that, right?

I don't think so. It wouldn't be the first game not working okay with the Debug runtime.
Anyways, if I were you I'd try to find out a way to make it work with retail or debug runtimes.
But I don't think that is a major problem.

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