patriciogonzalezvivo / glslViewer

Console-based GLSL Sandbox for 2D/3D shaders
BSD 3-Clause "New" or "Revised" License
4.67k stars 351 forks source link

[bug] Crash on launch #289

Closed niedzielski closed 1 year ago

niedzielski commented 2 years ago

Thank you for making this cool tool! I'd love to try it but it seems to crash without any diagnostic output. I tried v2.1.2 on Debian GNU / Linux 11 (Bullseye).

$ glslViewer --verbose
┌──────────────────────────────────────────────────────────────────────────────────────────────┐
│>                                                                                             │
└──$

A window appears briefly but the terminal gets screwed up (requires a reset) and the program exits almost immediately.

martinleopold commented 2 years ago

Same here on macOS 12.6, freshly built (no errors) for the upcoming course. Terminal messed up after crash as well.

https://user-images.githubusercontent.com/1692826/195301579-1535f9ff-03c7-4ace-8cc4-cf44718fba79.mov

Note that directly loading a shader seems to work e.g. glslViewer examples/2D/00_tests/test.frag, but the zsh prompt is messed up afterwards.

Also noticed, glslViewer --help shows

zsh: segmentation fault  glslViewer --help
Screen Shot 2022-10-12 at 11 11 58
patriciogonzalezvivo commented 2 years ago

Hi! good catch! I fixed the error in this one https://github.com/patriciogonzalezvivo/glslViewer/commit/15a3e957cfa59b8509eb88d7cada94610bfe8645

Do you mind giving it a try?

Next I will see how to prevent ncurses to break the terminal on errors.

martinleopold commented 2 years ago

Do you mind giving it a try?

Thanks for looking into it!

glslViewer (without arguments) now correctly displays usage info (just like glslViewer --help). Terminal is just fine after that.

Still getting zsh: segmentation fault glslViewer as last line of the output.

Normally exiting out of glslViewer (tried with glslViewer examples/2D/00_tests/test.frag then exit) now keeps the terminal mostly ok, only the prompts colors are changed:

prompt before glslViewer:

Screen Shot 2022-10-12 at 14 49 24

prompt after:

Screen Shot 2022-10-12 at 14 49 35
patriciogonzalezvivo commented 2 years ago

I temporally comment the color changing. https://github.com/patriciogonzalezvivo/glslViewer/commit/69219797a0f0ee83a2668cad8cdc98455348fa8f

I will look later on improving the entire ncurses solution... feels a bit glitchy at the moment

martinleopold commented 2 years ago

Thanks, confirming colors remain unchanged now!

Edit: BTW, when running from bash instead of zsh, there is a tiny bit more info on the segfault when running glslViewer --help:

Segmentation fault: 11
patriciogonzalezvivo commented 1 year ago

I belive this one was solved on the latest version 3.0.4.

niedzielski commented 1 year ago

Seems to work for me. Thank you!