Skip to content

Commit

Permalink
Merge pull request #7411 from RandomGamingDev/additional-sampler-type…
Browse files Browse the repository at this point in the history
…-support

Added support for other WebGL sampler types
  • Loading branch information
davepagurek authored Dec 7, 2024
2 parents a722f0e + 360fc04 commit 69580cf
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/webgl/p5.Shader.js
Original file line number Diff line number Diff line change
Expand Up @@ -1352,6 +1352,38 @@ p5.Shader = class {
}
}
break;
case gl.SAMPLER_CUBE:
case gl.SAMPLER_3D:
case gl.SAMPLER_2D_SHADOW:
case gl.SAMPLER_2D_ARRAY:
case gl.SAMPLER_2D_ARRAY_SHADOW:
case gl.SAMPLER_CUBE_SHADOW:
case gl.INT_SAMPLER_2D:
case gl.INT_SAMPLER_3D:
case gl.INT_SAMPLER_CUBE:
case gl.INT_SAMPLER_2D_ARRAY:
case gl.UNSIGNED_INT_SAMPLER_2D:
case gl.UNSIGNED_INT_SAMPLER_3D:
case gl.UNSIGNED_INT_SAMPLER_CUBE:
case gl.UNSIGNED_INT_SAMPLER_2D_ARRAY:
if (typeof data !== 'number') {
break;
}
if (
data < gl.TEXTURE0 ||
data > gl.TEXTURE31 ||
data !== Math.ceil(data)
) {
console.log(
'🌸 p5.js says: ' +
'You\'re trying to use a number as the data for a texture.' +
'Please use a texture.'
);
break;
}
gl.activeTexture(data);
gl.uniform1i(location, data);
break;
//@todo complete all types
}
return this;
Expand Down

0 comments on commit 69580cf

Please sign in to comment.