@kitware/vtk.js 26.1.1 → 26.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Rendering/OpenGL/Texture.js +47 -7
- package/package.json +1 -1
|
@@ -755,7 +755,13 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
755
755
|
|
|
756
756
|
model.context.pixelStorei(model.context.UNPACK_FLIP_Y_WEBGL, flip);
|
|
757
757
|
model.context.pixelStorei(model.context.UNPACK_ALIGNMENT, 1);
|
|
758
|
-
|
|
758
|
+
|
|
759
|
+
if (model._openGLRenderWindow.getWebgl2()) {
|
|
760
|
+
model.context.texStorage2D(model.target, 1, model.internalFormat, model.width, model.height);
|
|
761
|
+
model.context.texSubImage2D(model.target, 0, 0, 0, model.width, model.height, model.format, model.openGLDataType, scaledData[0]);
|
|
762
|
+
} else {
|
|
763
|
+
model.context.texImage2D(model.target, 0, model.internalFormat, model.width, model.height, 0, model.format, model.openGLDataType, scaledData[0]);
|
|
764
|
+
}
|
|
759
765
|
|
|
760
766
|
if (model.generateMipmap) {
|
|
761
767
|
model.context.generateMipmap(model.target);
|
|
@@ -819,7 +825,12 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
819
825
|
} // Source texture data from the PBO.
|
|
820
826
|
|
|
821
827
|
|
|
822
|
-
model.context.pixelStorei(model.context.UNPACK_ALIGNMENT, 1);
|
|
828
|
+
model.context.pixelStorei(model.context.UNPACK_ALIGNMENT, 1);
|
|
829
|
+
|
|
830
|
+
if (model._openGLRenderWindow.getWebgl2()) {
|
|
831
|
+
model.context.texStorage2D(model.target, 6, model.internalFormat, model.width, model.height);
|
|
832
|
+
} // We get the 6 images
|
|
833
|
+
|
|
823
834
|
|
|
824
835
|
for (var _i3 = 0; _i3 < 6; _i3++) {
|
|
825
836
|
// For each mipmap level
|
|
@@ -837,7 +848,12 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
837
848
|
tempData = invertedData[6 * j + _i3];
|
|
838
849
|
}
|
|
839
850
|
|
|
840
|
-
model.
|
|
851
|
+
if (model._openGLRenderWindow.getWebgl2()) {
|
|
852
|
+
model.context.texSubImage2D(model.context.TEXTURE_CUBE_MAP_POSITIVE_X + _i3, j, 0, 0, w, h, model.format, model.openGLDataType, tempData);
|
|
853
|
+
} else {
|
|
854
|
+
model.context.texImage2D(model.context.TEXTURE_CUBE_MAP_POSITIVE_X + _i3, j, model.internalFormat, w, h, 0, model.format, model.openGLDataType, tempData);
|
|
855
|
+
}
|
|
856
|
+
|
|
841
857
|
j++;
|
|
842
858
|
w /= 2;
|
|
843
859
|
h /= 2;
|
|
@@ -885,7 +901,13 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
885
901
|
// model.context.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
|
|
886
902
|
|
|
887
903
|
model.context.pixelStorei(model.context.UNPACK_ALIGNMENT, 1);
|
|
888
|
-
|
|
904
|
+
|
|
905
|
+
if (model._openGLRenderWindow.getWebgl2()) {
|
|
906
|
+
model.context.texStorage2D(model.target, 1, model.internalFormat, model.width, model.height);
|
|
907
|
+
model.context.texSubImage2D(model.target, 0, 0, 0, model.width, model.height, model.format, model.openGLDataType, data);
|
|
908
|
+
} else {
|
|
909
|
+
model.context.texImage2D(model.target, 0, model.internalFormat, model.width, model.height, 0, model.format, model.openGLDataType, data);
|
|
910
|
+
}
|
|
889
911
|
|
|
890
912
|
if (model.generateMipmap) {
|
|
891
913
|
model.context.generateMipmap(model.target);
|
|
@@ -931,7 +953,13 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
931
953
|
ctx.scale(1, -1);
|
|
932
954
|
ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, canvas.width, canvas.height);
|
|
933
955
|
var safeImage = canvas;
|
|
934
|
-
|
|
956
|
+
|
|
957
|
+
if (model._openGLRenderWindow.getWebgl2()) {
|
|
958
|
+
model.context.texStorage2D(model.target, 1, model.internalFormat, model.width, model.height);
|
|
959
|
+
model.context.texSubImage2D(model.target, 0, 0, 0, model.width, model.height, model.format, model.openGLDataType, safeImage);
|
|
960
|
+
} else {
|
|
961
|
+
model.context.texImage2D(model.target, 0, model.internalFormat, model.width, model.height, 0, model.format, model.openGLDataType, safeImage);
|
|
962
|
+
}
|
|
935
963
|
|
|
936
964
|
if (model.generateMipmap) {
|
|
937
965
|
model.context.generateMipmap(model.target);
|
|
@@ -1058,7 +1086,12 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
1058
1086
|
// model.context.pixelStorei(model.context.UNPACK_ALIGNMENT, 1);
|
|
1059
1087
|
// openGLDataType
|
|
1060
1088
|
|
|
1061
|
-
model.
|
|
1089
|
+
if (model._openGLRenderWindow.getWebgl2()) {
|
|
1090
|
+
model.context.texStorage3D(model.target, 1, model.internalFormat, model.width, model.height, model.depth);
|
|
1091
|
+
model.context.texSubImage3D(model.target, 0, 0, 0, 0, model.width, model.height, model.depth, model.format, model.openGLDataType, scaledData[0]);
|
|
1092
|
+
} else {
|
|
1093
|
+
model.context.texImage3D(model.target, 0, model.internalFormat, model.width, model.height, model.depth, 0, model.format, model.openGLDataType, scaledData[0]);
|
|
1094
|
+
}
|
|
1062
1095
|
|
|
1063
1096
|
if (model.generateMipmap) {
|
|
1064
1097
|
model.context.generateMipmap(model.target);
|
|
@@ -1293,7 +1326,14 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
1293
1326
|
|
|
1294
1327
|
|
|
1295
1328
|
model.context.pixelStorei(model.context.UNPACK_ALIGNMENT, 1);
|
|
1296
|
-
|
|
1329
|
+
|
|
1330
|
+
if (model._openGLRenderWindow.getWebgl2()) {
|
|
1331
|
+
model.context.texStorage2D(model.target, 1, model.internalFormat, model.width, model.height);
|
|
1332
|
+
model.context.texSubImage2D(model.target, 0, 0, 0, model.width, model.height, model.format, model.openGLDataType, newArray);
|
|
1333
|
+
} else {
|
|
1334
|
+
model.context.texImage2D(model.target, 0, model.internalFormat, model.width, model.height, 0, model.format, model.openGLDataType, newArray);
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1297
1337
|
publicAPI.deactivate();
|
|
1298
1338
|
return true;
|
|
1299
1339
|
};
|