Print-Screen not working in FullScreen; ScreenshotAppState ignoring alternate viewports

When I run my app in fullscreen, the print-screen key will always capture an incorrect screenshot (it appears to always capture the first frame that was displayed when the app started or whenever it last gained focus)

I tried using ScreenShotAppState as an alternative, but this also has issues capturing things displayed on alternate viewports, so I cannot use it for getting reliable screenshots of my game menus or HUD.

You can see an image containing two screenshots here; the bottom one is captured from ScreenShotAppState and the top one is a regular print-screen that I managed to get by tabbing out and then re-focusing the app right before taking the print-screen

The one that was captured using ScreenShotAppState is not showing the face in the status frame that is on an alternate viewport at the top left.

Does anyone know anything regarding these issues?

As mentioned on the other thread, a guess is that something is happening in a strange order. Like, the off screen texture is being cleared before screen shot app state gets to the screen… but even that sounds wrong because the frame should have what it had before until that quad+texture is redrawn (making a lot of assumptions here).

Another guess is that screen shot app state does something that prevents the off-screen frame from rendering properly… but I guess only in full screen?

I admit to rarely running in fullscreen because video capture won’t work and I’m always paranoid all of my desktop icons will get rearranged if something goes odd.

1 Like

Same for me up until this past month, I always found it easier to launch the app and test things quicker without fullscreen since that feels like it takes an extra few seconds to start than windowed mode. But I think I noticed lately that I can get better quality screenshots when its in fullscreen mode especially for things far away, and I know players will want to use that instead of windowed mode anyways so I’m hoping to get fullscreen mode working as smooth as possible.

I gave this a try in fullscreen mode with OBS and it seemed to work to screen-record a short video. Although the video does get slightly choppy in places where the game had lower framerate, this choppiness didn’t occur when I was recording but it does seem to be noticeable in the video that was produced.

For me OBS seems hit or miss. And I don’t know if it’s a setting or something.

I’ve had it record full screen video just fine and then I’ve narrated a 10 minute video only to find it only recorded a black screen.

1 Like

Have you tried using Windows Game-bar?, it’s designed to run in-game, one of the good Microsoft Apps indeed.

2 Likes

I will try to play around with some settings the next time I try to record a video and see if I have any luck, or maybe I’ll at least find out some more information regarding this issue to help solve it in the future.

Personally I have no problem using windowedmode to take a video if I have to, and I also have no problem using the suggested windows-game bar if I’m in fullscreen and need a screenshot.

But I think the underlying issues blocking OBS recording and the bug with full-screen screenshots capturing the wrong frame are both two issues that I would consider extremely important issue to solve before or during my game’s (eventual) beta testing phase so that players are able to take screenshots or videos using whatever screen-cap software they have. I know we could all just tell our player-bases how to work-around the issues, but there will inevitably be players who are too lazy or don’t care enoug hand end up deciding its not worth it.

Players sharing screenshots, streaming, and recording videos are all extremely beneficial to marketing a game, and it would be a shame to potentially miss out on that type of free organic reach (the best type!) because a player decides its too much work to share a video or screenshot with their friends. Customers are always more easily persuaded by friends and their favorite youtubers sharing a game, much more so than they are by paid ads. (not to mention the need for players sharing a screenshot or clip to report a bug)

So while it is good to have these workaround for us to get videos and screenshots in the meantime, I think it would be very beneficial to solve the underlying issues if we can.

I did a search and don’t appear to see any open issues related to either the full-screen screenshot issue or the recording issue. Should I go ahead and open 2 new issues (or does anyone else with more understanding of either issue want to go ahead and open them)?

My OBS full screen recording issue is not a JME issue, I think. I half remember this happening for another full screen application. It may even be fixed but since I run Windows 7 on that machine, I will never know because OBS stopped supporting win7.

As to the other, I’m still not sure if it’s a JME bug.

To file it as a JME bug, I think you’d have to come up with a test case that didn’t include an external library.

2 Likes

Yes based on your reply in my other thread about the viewports, it sounds like that library I am using is what is causing things in other viewports to be ignored by the ScreenShotAppState.


I have however managed to reproduce the other screenshot issue I mentioned that occurs in full screen mode without using ScreenShotAppState when you try to just use the regular print-screen functionality to copy a screenshot to the clipboard.

The image that gets copied to the clipboard when pressing the print-screen key doesn’t match what was rendered on screen when the key was pressed. It always captures the frame that was shown when the app last gained focus.

Here’s a very simple test case that just loads a simple green cube in full-screen mode:

package mygame;

import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.system.AppSettings;

public class Main extends SimpleApplication {

    public static void main(String[] args) {
        Main app = new Main();
        
        
        AppSettings settings = new AppSettings(true);        
        settings.setFullscreen(true);
        
        app.setSettings(settings);
        
        app.start();
    }

    @Override
    public void simpleInitApp() {
        
        Box boxMesh = new Box(1f,1f,1f); 
        Geometry boxGeo = new Geometry("Colored Box", boxMesh); 
        Material boxMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); 
        
        boxMat.setColor("Color", ColorRGBA.Green);
        boxGeo.setMaterial(boxMat); 
        rootNode.attachChild(boxGeo);
    }
    
}

After running this app you can reproduce the error by doing the 3 following steps:

  1. move the camera so the screen is showing a different frame than when the app loaded
  2. hit the print-screen key on your keyboard
  3. paste the results somewhere (I usually ctrl-v into paint) and now you will see the incorrect screenshot.

Instead of showing the image that was on screen when you hit print-screen, it will show the first frame that was rendered when you ran the app.

I also wonder if this is potentially a bug on my device exclusively, since I was able to reproduce it so easily and it doesn’t seem to be a known issue. So I’m curious to know if anyone manages to reproduce this issue by running this test case or if they are able to reproduce it in their other jme apps in full-screen as well.

1 Like

The classic approach: see if other lwjgl games fail in a similar way… or any other GPU-using games for that matter. The standard “Does it work on Minecraft?” response may still be appropriate… if you run the Java version.

1 Like