How to replace WebGL1Renderer with WebGLRender after initialization?

My application starts with WebGL 1 (WebGL1Renderer) since it uses instancing. I need to switch to WebGL2 (WebGLRenderer ) when viewing in VR. I simply tried to recreate the renderer with WebGLRender and it didn’t work. My three.js version is 128. Thanks for any suggestions!

You don’t need to use WebGL 1 for instancing. Everything that works in WebGL1 also works in WebGL 2.

Thanks a lot! Could you confirm that WenGL2 supports both EXT_frag_depth and ANGLE_instanced_arrays by default? I tested and found that’s the case.

However, the tests “renderer.extensions.get( “EXT_frag_depth” )” and “renderer.extensions.get( “ANGLE_instanced_arrays” )” all returned “null”. So we don’t need these tests or do we have new test functions?

See the “Feature you can take for granted” section here:

Both EXT_frag_depth and ANGLE_instanced_arrays are listed so I guess you are getting null as a sign that you will never need to check for those.


Also see: