Skip to content

Commit

Permalink
Merge pull request #1 from ramsoft-inc/fix/WON-3206-ios-float32-image…
Browse files Browse the repository at this point in the history
…-load-issue

WON-3206: apply unofficial patch fix for float issue on ios Kitware#3027 (comment)
  • Loading branch information
rsi-anish authored Mar 12, 2024
2 parents 3b24fb8 + 9a89b81 commit b8fa4db
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Sources/Rendering/OpenGL/Texture/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1291,8 +1291,8 @@ function vtkOpenGLTexture(publicAPI, model) {

function processDataArray(dataArray, preferSizeOverAccuracy) {
const numComps = dataArray.getNumberOfComponents();
const dataType = dataArray.getDataType();
const data = dataArray.getData();
let dataType = dataArray.getDataType();
let data = dataArray.getData();

// Compute min max from array
// Using the vtkDataArray.getRange() enables caching
Expand Down Expand Up @@ -1321,6 +1321,11 @@ function vtkOpenGLTexture(publicAPI, model) {
publicAPI.getOpenGLDataType(dataType, true);
}

if (dataType === VtkDataTypes.FLOAT && !!model.oglNorm16Ext && !model.context.getExtension('OES_texture_float_linear') && !minArray.some(x => x < -32767) && !maxArray.some(x => x > 32767)) {
data = new Int16Array(data);
dataType = VtkDataTypes.SHORT;
}

return {
numComps,
dataType,
Expand Down

0 comments on commit b8fa4db

Please sign in to comment.