@@ -644,10 +644,14 @@ function vtkOpenGLTexture(publicAPI, model) {
644
644
645
645
// if the opengl data type is half float
646
646
// 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
+ }
651
655
652
656
if ( halfFloat ) {
653
657
for ( let idx = 0 ; idx < data . length ; idx ++ ) {
@@ -1103,10 +1107,14 @@ function vtkOpenGLTexture(publicAPI, model) {
1103
1107
const useHalfFloatType = true ;
1104
1108
publicAPI . getOpenGLDataType ( dataType , useHalfFloatType ) ;
1105
1109
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
+ }
1110
1118
1111
1119
if ( ! useHalfFloat ) {
1112
1120
return false ;
0 commit comments