Skip to content

Commit efd1c86

Browse files
committed
WebXRManager.getBinding() creates XRWebGLBinding if needed + use elsewhere in WebXRManager
1 parent a6cebb9 commit efd1c86

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/renderers/webxr/WebXRManager.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,12 @@ class WebXRManager extends EventDispatcher {
346346
*/
347347
this.getBinding = function () {
348348

349+
if ( glBinding === null && supportsGlBinding ) {
350+
351+
glBinding = new XRWebGLBinding( session, gl );
352+
353+
}
354+
349355
return glBinding;
350356

351357
};
@@ -463,7 +469,7 @@ class WebXRManager extends EventDispatcher {
463469
scaleFactor: framebufferScaleFactor
464470
};
465471

466-
glBinding = new XRWebGLBinding( session, gl );
472+
glBinding = this.getBinding();
467473

468474
glProjLayer = glBinding.createProjectionLayer( projectionlayerInit );
469475

@@ -993,11 +999,7 @@ class WebXRManager extends EventDispatcher {
993999

9941000
if ( gpuDepthSensingEnabled && supportsGlBinding ) {
9951001

996-
if ( glBinding === null ) {
997-
998-
glBinding = new XRWebGLBinding( session, gl );
999-
1000-
}
1002+
glBinding = scope.getBinding();
10011003

10021004
const depthData = glBinding.getDepthInformation( views[ 0 ] );
10031005

@@ -1016,11 +1018,7 @@ class WebXRManager extends EventDispatcher {
10161018

10171019
renderer.state.unbindTexture();
10181020

1019-
if ( glBinding === null ) {
1020-
1021-
glBinding = new XRWebGLBinding( session, gl );
1022-
1023-
}
1021+
glBinding = scope.getBinding();
10241022

10251023
for ( let i = 0; i < views.length; i ++ ) {
10261024

0 commit comments

Comments
 (0)