oframe / ogl

Minimal WebGL Library
https://oframe.github.io/ogl/examples
3.77k stars 213 forks source link

Offscreen Canvas FPS drop? #127

Closed ibsusu closed 2 years ago

ibsusu commented 2 years ago

Hi, OGL doesn't work out of the box with offscreen canvas but I got it to work by modifying Renderer.js. Orbit too but but that's in extras.

From this line until the end of setSize needs to be commented out and the canvas' width and height need to be set manually to match the width and height passed into the renderer.

https://github.com/oframe/ogl/blob/e518a8290c7981921abbb2a9844e841d12fba122/src/core/Renderer.js#L118

I fully expected there to be other issues but for the life of me I can't figure out why the FPS suffers when it should all be on the GPU. Weird thing is that there are microtasks generated when running the offscreen canvas vs not. I have no idea why.

Anyways, I'm not sure if this is OGL related I just wanted to put this out there in case someone else ran into the problem.

Thanks for the awesome library!

ibsusu commented 2 years ago

not related to ogl. This is just some browser shenanigans.

Love you work, I'll keep any issues to myself until I'm sure they can help.