Home » Community » Forums » » Generating a Screenshot in DirectX 8.1
  Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic


 Last Thread Next Thread 
 Generating a Screenshot in DirectX 8.1
Post Reply 
Has anyone tried this when running their app in windowed mode? It seems that obtaining the front buffer in windowed mode grabs the WHOLE screen (i.e windows start bar, other windows visible etc).

 User Rating: 1015    Report this Post to a Moderator | Link

G'day!

The last parameter is the RECT to grab from, so if you provide your window rect, you should be fine.


Stay Casual,

Ken
Drunken Hyena

 User Rating: 1457   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Wouldn't that fail if part of the window was offscreen?


----------------------------
I HATE COLLISION DETECTION!!

 User Rating: 1788   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

That's a good question. I personally havn't tried to take any screen shots from a windowed app that was only half visible so I don't know what would happen.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I tried it, and it DID fail whenever the window was partly offscreen, its safer to just grab the whole screen.
I dont know if this would affect whether or not you should 'watermark' the screenshot. If the shot shows other apps, including the Microsoft windows OS, would they be happy for you to watermark it with your company logo?


----------------------------
I HATE COLLISION DETECTION!!

 User Rating: 1788   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

How do you do this in VB?

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

never mind. i was using DX8.0 which didn't have that function

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

What's the problem with the RECT parameter? Just clamp it to the resolution and you won't get problems with off-screen coordinates.

 User Rating: 1047   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

How do I go about saving JPG files? A 1024x768 24 bit BMP is 2.25MB which is way too big. I tried changing save line to

D3DXSaveSurfaceToFile(file_name, D3DXIFF_JPG, frontbuf, NULL, NULL)

but it's failing. My program loads JPGs just fine.

Ben


IcarusIndie.com [ The Rabbit Hole | The Labyrinth | DevZone | Gang Wars | The Wall | Hosting ]


 User Rating: 1001   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

If u check the SDK i think there is no support for jpeg

 User Rating: 1788   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

According to the SDK the save function only supports .BMP and .DDS. That makes no sense why it can load JPGs but can't save them.

Oh well.

Ben


IcarusIndie.com [ The Rabbit Hole | The Labyrinth | DevZone | Gang Wars | The Wall | Hosting ]


 User Rating: 1001   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I think there is no need to create ftontbuffer surface.

GetFrontBuffer is not a copying function. It returns a reference to the original front buffer.

So beginning of the code must be this :

IDirect3DSurface8* frontbuf;

// this is wrong
// device->CreateImageSurface(screenx,screeny,D3DFMT_A8R8G8B8,&frontbuf);

HRESULT hr = device->GetFrontBuffer(frontbuf);

Ofcourse I might be wrong. Please inform me

xtro@gmx.com.tr

 User Rating: 1015    Report this Post to a Moderator | Link

Re: Saving screenshots as JPEGs

Personally, I would just save the bitmap as shown, then, behind the scenes, convert it using OpenIL to whatever format you want, then delete the original bitmap.

Just to be safe, this is probably something that should be done in a part of the program which is not time-critical. (ie - at shutdown time)

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

The reason you create a surface before the call to GetFrontBuffer() is because GetFrontBuffer() copies the the contents of the front buffer to another surface. Therefore, if you didn't have a surface to copy to you would be in a world of hurt =). For those of you interested there is another thread in the DirectX forum that addresses the screen shots in windowed mode question. http://www.gamedev.net/community/forums/topic.asp?topic_id=102697


 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

When I attempted to implement this I continually get an INVALID_CALL returned from the call to getFrontBuffer.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Never mind. I was running in windowed mode and not taking into account my screen resolution.

 User Rating: 1015    Report this Post to a Moderator | Link

Never mind. I was running in windowed mode and not taking into account my screen resolution.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: