How do i take screengrabs?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Rishavs
Party member
Posts: 103
Joined: Sat Oct 17, 2009 5:29 am
Contact:

How do i take screengrabs?

Post 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?
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: How do i take screengrabs?

Post 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)
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
Rishavs
Party member
Posts: 103
Joined: Sat Oct 17, 2009 5:29 am
Contact:

Re: How do i take screengrabs?

Post by Rishavs »

Thanks. Stupid followup: why is it so?

the print screen works for everything else. Why doesnt it works on Love window?
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: How do i take screengrabs?

Post 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.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
Rishavs
Party member
Posts: 103
Joined: Sat Oct 17, 2009 5:29 am
Contact:

Re: How do i take screengrabs?

Post by Rishavs »

okie dokie. will wait for you. :D

EDIT: tried alt + PrntScrn. Same as before. Captures all windows below the game window.
User avatar
radgeRayden
Prole
Posts: 29
Joined: Sun Jul 27, 2014 6:49 pm
Location: Brasil
Contact:

Re: How do i take screengrabs?

Post 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.
Last edited by radgeRayden on Tue Jan 12, 2016 5:20 pm, edited 2 times in total.
User avatar
pgimeno
Party member
Posts: 3551
Joined: Sun Oct 18, 2015 2:58 pm

Re: How do i take screengrabs?

Post 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.
User avatar
radgeRayden
Prole
Posts: 29
Joined: Sun Jul 27, 2014 6:49 pm
Location: Brasil
Contact:

Re: How do i take screengrabs?

Post by radgeRayden »

This answer on Arqade can give some insight into the matter: http://gaming.stackexchange.com/a/131516
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: How do i take screengrabs?

Post 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)
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
Rishavs
Party member
Posts: 103
Joined: Sat Oct 17, 2009 5:29 am
Contact:

Re: How do i take screengrabs?

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

Who is online

Users browsing this forum: Google [Bot] and 39 guests