@@ -644,10 +644,14 @@ function vtkOpenGLTexture(publicAPI, model) {
644644
645645 // if the opengl data type is half float
646646 // then the data array must be u16
647- const halfFloatExt = model . context . getExtension ( 'OES_texture_half_float' ) ;
648- const halfFloat = model . _openGLRenderWindow . getWebgl2 ( )
649- ? model . openGLDataType === model . context . HALF_FLOAT
650- : halfFloatExt && model . openGLDataType === halfFloatExt . HALF_FLOAT_OES ;
647+ let halfFloat = false ;
648+ if ( model . _openGLRenderWindow . getWebgl2 ( ) ) {
649+ halfFloat = model . openGLDataType === model . context . HALF_FLOAT ;
650+ } else {
651+ const halfFloatExt = model . context . getExtension ( 'OES_texture_half_float' ) ;
652+ halfFloat =
653+ halfFloatExt && model . openGLDataType === halfFloatExt . HALF_FLOAT_OES ;
654+ }
651655
652656 if ( halfFloat ) {
653657 for ( let idx = 0 ; idx < data . length ; idx ++ ) {
@@ -1103,10 +1107,14 @@ function vtkOpenGLTexture(publicAPI, model) {
11031107 const useHalfFloatType = true ;
11041108 publicAPI . getOpenGLDataType ( dataType , useHalfFloatType ) ;
11051109
1106- const halfFloatExt = model . context . getExtension ( 'OES_texture_half_float' ) ;
1107- const useHalfFloat = model . _openGLRenderWindow . getWebgl2 ( )
1108- ? model . openGLDataType === model . context . HALF_FLOAT
1109- : halfFloatExt && model . openGLDataType === halfFloatExt . HALF_FLOAT_OES ;
1110+ let useHalfFloat = false ;
1111+ if ( model . _openGLRenderWindow . getWebgl2 ( ) ) {
1112+ useHalfFloat = model . openGLDataType === model . context . HALF_FLOAT ;
1113+ } else {
1114+ const halfFloatExt = model . context . getExtension ( 'OES_texture_half_float' ) ;
1115+ useHalfFloat =
1116+ halfFloatExt && model . openGLDataType === halfFloatExt . HALF_FLOAT_OES ;
1117+ }
11101118
11111119 if ( ! useHalfFloat ) {
11121120 return false ;
0 commit comments