Pass `gl` context
luruke opened this issue · 2 comments
luruke commented
Creating a gl
context is expensive.
Currently unless a forceRendererString
is passed, the lib creates a new context.
Maybe we can add an option to pass an existing context?
TimvanScherpenzeel commented
Sure that sounds like a good idea
TimvanScherpenzeel commented
I've added the option glContext
to pass in an existing WebGL context which avoids the internal creation of one.
See https://github.com/TimvanScherpenzeel/detect-gpu/blob/9d2fe31f514fedb6b18214117125ae8edb656a3f/index.html#L69-L89 for an example
Thanks for your suggestion!
The option is available from 1.1.0
onwards on NPM