screenshots in d3d

ThePentiumGuy

Senior Contributor
Joined
May 21, 2003
Messages
1,113
Location
Boston, Massachusetts
hey guys,
how would i take a screenshot(printscreen) of my d3d app?
if i try to do it, i end up getting a big green square.. which is supposedly my world..

any help would be appreciated, thanks
pent
 
If I remember correctly (doing this from memory) you can just call 3D3Device.Getbackbuffer to get access your back buffer surface

Then Call Direct3D.SurfaceLoader.Save to save the surface that is returned from the 3D3Device.Getbackbuffer method.

Hope that Helps.

NOTE: Make sure you don't do a D3DDevice.clear before you save or u will save an empty image...
 
i got it to work, a friend of mine (darc, from this forum) sent me his function, and it seems to work pretty well

PrivateFunction GetScreenCapture(ByVal FileName AsString, OptionalByVal FullScreen AsBoolean = False) As Image

' Captures the current screen and returns as an Image

' object

Dim objSK As SendKeys

Dim imgCapture As Image

If FullScreen = TrueThen

' Print Screen pressed twice here as some systems

' grab active window "accidentally" on first run

objSK.SendWait("{PRTSC 2}")

Else

objSK.SendWait("%{PRTSC}")

EndIf

Dim objData As IDataObject = Clipboard.GetDataObject()

ReturnCType(objData.GetData(DataFormats.Bitmap), Bitmap)

EndFunction

heh i have no idea how it works :),

thanks for your help guys, sorry, i couldnt get it to work tho
 
I would call that the worst method you can use because DirectX provides functionality to take screenshots. What didn't work for you while using D3D to take the screenshot?
 
Back
Top