markaren / threepp

C++20 port of three.js (r129)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Assertion Failed error when minimizing application

Plingaas opened this issue · comments

commented

Upon minimizing my threepp application I get an error and the program crashes with the following output:

Assertion failed: width > 0, file C:\Users\peter\Documents\vcpkg\buildtrees\threepp\src\ee0c203ca4-4c0a13da5e.clean\glte
xt.h, line 356

Process finished with exit code 3

Was going to comment on the version used and were going to suggest trying with a the neweset vcpkg package, which is 009f337794acefcc548e37f53a9fd16d29a5cfc4. However, I'm able to reproduce. Seemingly, I've never tried to minimize a threepp application before.

So this bug appears consistently when using the textHandle feature in debug mode. Until a fix is found, you can use a release configuration if you need to minimize the application, as assertertions are only evaluated in debug mode.

void threepp::TextHandle::setViewport(int width, int height) {
        gltViewport(width, height);
}

when the window is minimized, width and height is 0 here.

This fixes it:

void threepp::TextHandle::setViewport(int width, int height) {
    if (width > 0 && height > 0) {
        gltViewport(width, height);
    }
}

Will ship with the next vcpkg release.