Page 1 of 1

Screenshots after InitEngine3D()

Posted: Mon Dec 26, 2011 11:48 am
by Arcturus
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.

Re: Screenshots after InitEngine3D()

Posted: Mon Dec 26, 2011 6:51 pm
by PMV
You could use ScreenOutput() as long as you are using DirectX.

Re: Screenshots after InitEngine3D()

Posted: Mon Dec 26, 2011 8:45 pm
by Comtois
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)
EndIf

Re: Screenshots after InitEngine3D()

Posted: Mon Dec 26, 2011 9:13 pm
by xorc1zt
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