Page 1 of 1

How do i take screengrabs?

Posted: Tue Jan 12, 2016 10:15 am
by Rishavs
Hi

Just found something which blew my tinny mind.
I created a simple love2d app and wanted to take a screenshot of it.

I pressed PrntScrn button. But everytime it captures the screengrab of the windows underneath the game.

For reference, I am using the full scresn mode as defined

Code: Select all

    
              t.window.fullscreen = true        -- Enable fullscreen (boolean)
              t.window.fullscreentype = "desktop"
Any idea how can I take screenshots of my game?

Re: How do i take screengrabs?

Posted: Tue Jan 12, 2016 10:17 am
by zorg
[wiki]love.graphics.newScreenshot[/wiki], though on windows, the printscreen should capture the whole desktop, and alt+printscreen should capture the active window. Nevertheless, doing it with that function makes it easier since it can save it to files automatically (if you look at the example on the wiki)

Re: How do i take screengrabs?

Posted: Tue Jan 12, 2016 10:37 am
by Rishavs
Thanks. Stupid followup: why is it so?

the print screen works for everything else. Why doesnt it works on Love window?

Re: How do i take screengrabs?

Posted: Tue Jan 12, 2016 10:59 am
by zorg
I can't say, because on my system (Win7x64), it... well, when i last tested it, it worked.
I'll test it on 0.10.0 later today.

Re: How do i take screengrabs?

Posted: Tue Jan 12, 2016 12:07 pm
by Rishavs
okie dokie. will wait for you. :D

EDIT: tried alt + PrntScrn. Same as before. Captures all windows below the game window.

Re: How do i take screengrabs?

Posted: Tue Jan 12, 2016 5:10 pm
by radgeRayden
Now, I might be wrong here, but I'm pretty sure you can't take screenshots of fullscreen OpenGL/DirectX applications, because they bypass the windowing system or something like that. Real fullscreen is a big deal after all. So in order to take a screenshot you need a program that intercepts OpenGL (eg. Fraps) OR let the game do it itself since it has control over the drawing.

PS: also if you really want to be able to take screenshots the usual way you can use 'fake' fullscreen (the 'desktop' mode in conf.lua), it's just a borderless window that covers the whole screen and therefore do not present the same issue.

Re: How do i take screengrabs?

Posted: Tue Jan 12, 2016 5:13 pm
by pgimeno
It's probably that your graphics card's driver doesn't support capturing an OpenGL app. It should probably happen with other OpenGL apps. Tried it?

In my case (Linux), the capture tool (xwd) captures also OpenGL windows, but for some reason Flash applets aren't included; they show as a uniform colour.

Re: How do i take screengrabs?

Posted: Tue Jan 12, 2016 5:19 pm
by radgeRayden
This answer on Arqade can give some insight into the matter: http://gaming.stackexchange.com/a/131516

Re: How do i take screengrabs?

Posted: Tue Jan 12, 2016 5:46 pm
by zorg
I promised, so i tested it on my system with a benchmark app i made for testing micro-stutter, and after i made sure i was using Aero, here are my results:
  • On my 64bit Win7 desktop, the printscreen key could capture the 0.10.0 löve projects' window's contents in all modes, that is, windowed, desktop fullscreen and exclusive fullscreen.
I didn't disable desktop compositing on löve either, since that would toss my desktop back to simple mode everytime it is run, which didn't happen.
Also, i have a GeForce GTX 750 Ti and a GTX 960, maybe that matters, i don't know.

In any case, you could/should still implement a function to save the imagedata made by lg.newscreenshot on a keypress, like F12 (usually) for comp. builds misbehaving with the OS print screen functionality. :3

(Semi-unrelated, but on my android 5.whatever tablet, i couldn't take a screenshot of iirc the Chrome browser app, but I could of the löve app, so yeah :D)

Re: How do i take screengrabs?

Posted: Tue Jan 12, 2016 7:33 pm
by Rishavs
Thanks for the insights everyone. and thank you zorg for testing it on your side.
always good to learn new things.

i am assuming that my shitty Intel HD4000 doesnt have all the bells and whistles required to capture OpenGL windows.
Being a lazy bum i just changed the mode to windowed and took the screenshots. :p