yew icon indicating copy to clipboard operation
yew copied to clipboard

WebGL example loops through the 'render_gl` function every frame.

Open kulicuu opened this issue 2 years ago • 1 comments

Problem I am returning to WebGL work after some time away (with Vulkan) so may be misinterpreting something here, but... The WebGL example loops through the render_gl function every frame. Therefore it's recompiling the shaders, linking them, all of this work that doesn't need to be repeated in the render loop.

Steps To Reproduce Steps to reproduce the behavior: Start the app as normal, set a log statement inside render_gl function but outside the closure I assume is intended for the actual render-loop logics, and see the numbers climb with every frame.

Expected behavior I would expect the main body of render_gl to not be re-executed with every frame. For example, the shaders should be compiled and linked once only.

Screenshots If applicable, add screenshots to help explain your problem.

Environment:

  • Yew 19.3
  • Rust stable
  • Build tool trunk

kulicuu avatar Jun 28 '22 19:06 kulicuu

I think you assume correctly. PRs welcome, this should be possible much more efficiently as you said :)

WorldSEnder avatar Jun 28 '22 20:06 WorldSEnder