Screenshots after InitEngine3D()

Just starting out? Need help? Post your questions and find answers here.
Arcturus
User
User
Posts: 14
Joined: Tue Jan 26, 2010 11:23 am
Location: Australia
Contact:

Screenshots after InitEngine3D()

Post 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.
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
PMV
Enthusiast
Enthusiast
Posts: 727
Joined: Sat Feb 24, 2007 3:15 pm
Location: Germany

Re: Screenshots after InitEngine3D()

Post by PMV »

You could use ScreenOutput() as long as you are using DirectX.
User avatar
Comtois
Addict
Addict
Posts: 1432
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: Screenshots after InitEngine3D()

Post 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
Please correct my english
http://purebasic.developpez.com/
xorc1zt
Enthusiast
Enthusiast
Posts: 276
Joined: Sat Jul 09, 2011 7:57 am

Re: Screenshots after InitEngine3D()

Post 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
Post Reply