0x3C50 / Renderer

An easy to use rendering library for Minecraft mods using the Fabric toolchain
Other
185 stars 17 forks source link

change: cache GL viewport #51

Closed Octol1ttle closed 1 month ago

Octol1ttle commented 1 month ago

Getting the viewport from GL is a JNI call, which is expensive. Using worldSpaceToScreenSpace or screenSpaceToWorldSpace multiple times per frame can make a serious impact on performance:

The examples below don't use the Renderer lib directly, but rather a copy of worldSpaceToScreenSpace slightly adjusted for my project's needs

No caching: image

Caching: image