jf_knight
Member
I keep receiving a syntax error when I attempt to run this shader
I believe the problem could be something with the lines
It' a small lava lamp shader I found. I'm trying to run it in GM.
I'm relatively new to shaders, so any bit of help is welcome.
//Fragment
//vertex
Theres an object in a room that has
" shader_set_uniform_f(iTime,get_timer()/1000000);
shader_set_uniform_f(iResolution,720,480,0)" , ect...
I believe the problem could be something with the lines
Code:
out vec4 c;
in vec2 w ;
I'm relatively new to shaders, so any bit of help is welcome.
//Fragment
Code:
uniform float iTime;
uniform vec2 iResolution;
varying vec2 fragCoord;
void main(void)
{
out vec4 c;
in vec2 w ;
vec2 p = w/iResolution.xy, a = p*5.; a.y -= iTime;
vec2 f = fract(a); a -= f; f = f*f*(3.-2.*f);
vec4 r = fract(sin(vec4(a.x + a.y*1e3) + vec4(0, 1, 1e3, 1001)) * 1e5)*30./p.y;
c.rgb = p.y + vec3(1,.5,.2) * clamp(mix(mix(r.x, r.y, f.x), mix(r.z, r.w, f.x), f.y)-30., -.2, 1.);
}
//vertex
Code:
attribute vec3 in_Position; // (x,y,z)
//attribute vec3 in_Normal; // (x,y,z) unused in this shader.
//attribute vec4 in_Colour; // (r,g,b,a) unused in this shader.
//attribute vec2 in_TextureCoord; // (u,v) unused in this shader.
varying vec2 fragCoord;
void main()
{
vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0);
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
fragCoord = in_Position.xy;
}
" shader_set_uniform_f(iTime,get_timer()/1000000);
shader_set_uniform_f(iResolution,720,480,0)" , ect...