Giter Club home page Giter Club logo

Comments (8)

Andrettin avatar Andrettin commented on August 19, 2024

Thanks reporting this issue; unfortunately I am not able to reproduce it.

SysReq also takes a screenshot, so the issue is likely with the Screenshot() function itself (or the SaveScreenshotPNG() function it calls).

Does this crash happen both when you are playing with OpenGL rendering enabled, and when it is disabled?

from wyrmgus.

johndh avatar johndh commented on August 19, 2024

The crash only happens with OpenGL rendering enabled. As it turns out, it was taking screenshots, but I was expecting to find them in my Pictures folder where screenshots normally go. I hadn't thought to look in ~/Wyrmgus. The ones that resulted in crashes turned out rather oddly, while the ones with OpenGL disabled turned out fine.

Odd result:
screen01

from wyrmgus.

Andrettin avatar Andrettin commented on August 19, 2024

Thanks, that's helpful :)

So the issue is likely in the following piece of code in SaveScreenshotPNG() (in \video\png.cpp):

#if defined(USE_OPENGL) || defined(USE_GLES)
    if (UseOpenGL) {
        std::vector<unsigned char> pixels;
        pixels.resize(Video.Width * Video.Height * 3);
#ifdef USE_OPENGL
        glReadBuffer(GL_FRONT);
#endif
        glReadPixels(0, 0, Video.Width, Video.Height, GL_RGB, GL_UNSIGNED_BYTE, &pixels[0]);
        for (int i = 0; i < Video.Height; ++i) {
            png_write_row(png_ptr, &pixels[(Video.Height - 1 - i) * Video.Width * 3]);
        }
    } else
#endif

from wyrmgus.

Andrettin avatar Andrettin commented on August 19, 2024

timfel has made an update to fix this issue, which I've implemented into Wyrmgus here:
f271eb5

Does it fix the problem for you?

from wyrmgus.

johndh avatar johndh commented on August 19, 2024

The game no longer crashes upon taking a screenshot most of the time, but the screenshot is still gray and distorted as before (or a corrupted file), and the game freezes upon trying to exit if I previously took a screenshot during that session. It still sometimes causes the game to freeze, which seems to occur more when I've switched from windowed to fullscreen. I also still managed to crash it once by just taking a screenshot in the opening menu (output below). As before, everything is fine with OpenGL disabled.

*** Error in `./stratagus': double free or corruption (out): 0x0000000015b59460 ***
./launch: line 1: 31990 Aborted                 ./stratagus -d ~/Wyrmsun/ -u ~/Wyrmsun/

In this case ./launch refers to ./stratagus -d ~/Wyrmsun/ -u ~/Wyrmsun/, the script I use to launch the game.

from wyrmgus.

Andrettin avatar Andrettin commented on August 19, 2024

Unfortunate that it didn't fix the problem, but at least there was some improvement. There was a further update from upstream on this issue which I've implemented into Wyrmgus, maybe it will help:
a645c96

from wyrmgus.

johndh avatar johndh commented on August 19, 2024

That doesn't seem to have made any difference.

from wyrmgus.

Andrettin avatar Andrettin commented on August 19, 2024

This should be fixed now with the following commit:
9514a22

from wyrmgus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.