Page 1 of 1

Patch to cache rendered backgrounds for better FPS.

Posted: Thu Jan 11, 2018 8:17 am
by Iamnotalice
This patch adds an option to render the background to a texture so it doesn't need to be rerendered every frame. On my system it brings a massive improvement in FPS - I have a 1600-star universe that is ~4FPS on my machine using normal settings, ~12FPS with my patch.

Bugs in my patch:
- It currently only updates the background after you resize the window or move the galaxy map coordinates, not after turn advance.
- There is some entertaining visual glitching when dragging the galaxy map around (and the framerate drops back down).
- There is also visual glitching when the game is defocused.
- The preference to toggle background caching doesn't have a proper label.
- Visibility circles are a bit of a mess - the OpenGL docs say the framebuffer objects don't have a stencil buffer or something?

Other weaknesses:
- I don't know OpenGL or C++, so my code may not be very good.
- I haven't tested it on anything but Debian.

Re: Patch to cache rendered backgrounds for better FPS.

Posted: Thu Jan 11, 2018 8:28 am
by Geoff the Medio
What is "the background" ?

Re: Patch to cache rendered backgrounds for better FPS.

Posted: Thu Jan 11, 2018 9:49 am
by Iamnotalice
The galaxy map, with associated starlanes/molecular clouds/systems/visibility range circles.

Re: Patch to cache rendered backgrounds for better FPS.

Posted: Thu Jan 11, 2018 9:59 am
by Geoff the Medio
If there are major graphical artifacts are a result, the patch is probably not acceptable...

Re: Patch to cache rendered backgrounds for better FPS.

Posted: Thu Jan 11, 2018 10:22 am
by Iamnotalice
Expected as much; the point of posting it was to see if it's worth taking the time to polish it up. (AFAICT fixing the glitches shouldn't bring back the performance hit, but figuring out how will take me a while.)

Re: Patch to cache rendered backgrounds for better FPS.

Posted: Thu Jan 11, 2018 10:34 am
by Geoff the Medio
If you can make it work mostly without glitches, then it could be useful.

Re: Patch to cache rendered backgrounds for better FPS.

Posted: Sun Jan 14, 2018 10:49 am
by Vezzra
@Iamnotalice, it would be preferable if you provide your patches as PRs on our github repo.