@@ -589,8 +589,6 @@ class XRManager extends EventDispatcher {
589
589
590
590
//
591
591
592
- const attributes = gl . getContextAttributes ( ) ;
593
-
594
592
if ( this . _useLayers === true ) {
595
593
596
594
// default path using XRWebGLBinding/XRProjectionLayer
@@ -599,11 +597,11 @@ class XRManager extends EventDispatcher {
599
597
let depthType = null ;
600
598
let glDepthFormat = null ;
601
599
602
- if ( attributes . depth ) {
600
+ if ( renderer . depth ) {
603
601
604
- glDepthFormat = attributes . stencil ? gl . DEPTH24_STENCIL8 : gl . DEPTH_COMPONENT24 ;
605
- depthFormat = attributes . stencil ? DepthStencilFormat : DepthFormat ;
606
- depthType = attributes . stencil ? UnsignedInt248Type : UnsignedIntType ;
602
+ glDepthFormat = renderer . stencil ? gl . DEPTH24_STENCIL8 : gl . DEPTH_COMPONENT24 ;
603
+ depthFormat = renderer . stencil ? DepthStencilFormat : DepthFormat ;
604
+ depthType = renderer . stencil ? UnsignedInt248Type : UnsignedIntType ;
607
605
608
606
}
609
607
@@ -632,8 +630,8 @@ class XRManager extends EventDispatcher {
632
630
type : UnsignedByteType ,
633
631
colorSpace : renderer . outputColorSpace ,
634
632
depthTexture : new DepthTexture ( glProjLayer . textureWidth , glProjLayer . textureHeight , depthType , undefined , undefined , undefined , undefined , undefined , undefined , depthFormat ) ,
635
- stencilBuffer : attributes . stencil ,
636
- samples : attributes . antialias ? 4 : 0
633
+ stencilBuffer : renderer . stencil ,
634
+ samples : renderer . samples
637
635
} ) ;
638
636
639
637
this . _xrRenderTarget . hasExternalTextures = true ;
@@ -643,10 +641,10 @@ class XRManager extends EventDispatcher {
643
641
// fallback to XRWebGLLayer
644
642
645
643
const layerInit = {
646
- antialias : attributes . antialias ,
644
+ antialias : renderer . samples > 0 ,
647
645
alpha : true ,
648
- depth : attributes . depth ,
649
- stencil : attributes . stencil ,
646
+ depth : renderer . depth ,
647
+ stencil : renderer . stencil ,
650
648
framebufferScaleFactor : this . getFramebufferScaleFactor ( )
651
649
} ;
652
650
@@ -665,7 +663,7 @@ class XRManager extends EventDispatcher {
665
663
format : RGBAFormat ,
666
664
type : UnsignedByteType ,
667
665
colorSpace : renderer . outputColorSpace ,
668
- stencilBuffer : attributes . stencil
666
+ stencilBuffer : renderer . stencil
669
667
}
670
668
) ;
671
669
0 commit comments