In my program, I'm trying to code a feature which takes a screenshot and saves it with a keystroke. The GrabSprite() command works fine, although as soon as I add InitEngine3D() into my code, all I get is a black image. I'm trying to make a 3D game so I want to be able to take a screenshot with 3D enabled.
Any help would be appreciated.
Screenshots after InitEngine3D()
Screenshots after InitEngine3D()
Give a man fire and he's warm for a day; set a man on fire and he's warm for the rest of his life
Re: Screenshots after InitEngine3D()
You could use ScreenOutput() as long as you are using DirectX.
Re: Screenshots after InitEngine3D()
When i need an image from my 3D stuff, i use this code. It work only with window (then i use Paint to save it).
Code: Select all
If KeyboardReleased(#PB_Key_F5)
keybd_event_(#VK_SNAPSHOT,0,0,0)
EndIfPlease correct my english
http://purebasic.developpez.com/
http://purebasic.developpez.com/
Re: Screenshots after InitEngine3D()
this code should run fine but produce a crash here.
Code: Select all
InitKeyboard()
InitSprite()
OpenWindow(0, 100, 100, 800, 600, "test")
OpenWindowedScreen(WindowID(0), 0, 0, 800, 600, 1,0,0)
Repeat
ExamineKeyboard()
If KeyboardReleased(#PB_Key_F5)
keybd_event_(#VK_SNAPSHOT,0,0,0)
Define result.i = GetClipboardImage(#PB_Any)
If result
Define filename.s = SaveFileRequester("Please choose file to save", "", "Bitmap (*.bmp)|*.bmp", 0)
Else
Debug "error GetClipboardImage(#PB_Any)"
EndIf
If filename
SaveImage(result, filename)
FreeImage(result)
EndIf
EndIf
Until WindowEvent() = #PB_Event_CloseWindow


