[GEM-dev] array in glsl; was: [pd-gem:gem] 5 new commits to Gem-code

IOhannes m zmölnig zmoelnig at iem.at
Fri Dec 1 11:59:34 CET 2023


On 11/28/23 09:58, cyrille henry wrote:
> Hello all, Iohannes
> 
> I noticed few commit about arrays support in glsl_program.
> Do you have a small example on the way to use array in shaders?

see the attached example.

vmfds
IOhannes



-------------- next part --------------
#version 120
/* uniform arrays require a minimum version of 120 */

/* a 4-element array */
uniform float myArray[4];
/* a 2-element vector */
uniform vec2 dimen;

uniform sampler2D MyTex;

void main() {
  vec2 uv = gl_FragCoord.xy / dimen;
  vec4 gain = vec4(myArray[0], myArray[1], myArray[2], myArray[3]);
  gl_FragColor = (texture2D(MyTex, uv)) * gain;
}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: shaderarrays.pd
Type: text/x-puredata
Size: 3125 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/gem-dev/attachments/20231201/cdf01b0f/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puredata.info/pipermail/gem-dev/attachments/20231201/cdf01b0f/attachment.sig>


More information about the GEM-dev mailing list