• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Shaders [Solved] Arrays and Shaders

K

KitKatKatu

Guest
So, ideally I would love to have a uniform vec2 array, but I don't know if that's possible and I can't even get a uniform float array to work.

I'm using shader_set_uniform_f_array() for the first time and in the yoyo doc it doesn't say how you write it in the shader. I found an example online saying it needs to be written like this:
Code:
uniform float myValues[12];
What do you do if the length of the array "myValues" changes depending on which object is being drawn? How do you write that? I tried making a new float (i tried making it an int too):
Code:
shader_set_uniform_f( array_length, array_length_1d(global.myValues) )
but i'm getting errors on
Code:
uniform float array_length;
uniform float myValues[array_length];
Any tips?
 
K

KitKatKatu

Guest
I put in a random length for the array (12 because I knew I'd never have more than 12 entrees) and the code works fine. But I'd love to see if I can make vec2 arrays. Will try it and report back.

edit: as far as i can tell, vec2 arrays do not exist at all lol
 
Last edited by a moderator:
Top