Having trouble with screen shot

Started by
3 comments, last by mdias 19 years, 5 months ago
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!
I WISH SOMEONE WOULD FIX THE DAMNED LOGIN!
Advertisement
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.
move the code outside the Clear() / BeginScene() -> EndScene() / Present.
Ethereal
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?
I WISH SOMEONE WOULD FIX THE DAMNED LOGIN!
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.

This topic is closed to new replies.

Advertisement