I'm trying to implement this 'simple' shader outlined here.
The default 'pass through' shader GMS2 generates works fine without issues, but when I follow the steps for this one I get the following:
GLSL:
or GLSL ES:
Compile failure:
Vertex Shader: sh_lighting at line 8 : 'gm_BaseTexture'
Vertex Shader: sh_lighting at line 8 : 'texture2D'
Vertex Shader: sh_lighting at line 8 : '='
Vertex Shader: sh_lighting at line 27 : 'gl_FragColor'
Vertex Shader: sh_lighting at line 27 : 'assign'
Shader Code:
I'm not sure if this is due to shader type & syntaxing or missing DLL's as I have read elsewhere..but considering the simple passthrough shader works I think I'm ok regarding that ..
The default 'pass through' shader GMS2 generates works fine without issues, but when I follow the steps for this one I get the following:
GLSL:
GML:
############################################################################################
FATAL ERROR in Vertex Shader compilation
ShaderName: sh_lighting
Invalid shader
at gml_Object_octrl_Draw_64 (line 19) - shader_set(sh_lighting);
############################################################################################
gml_Object_octrl_Draw_64 (line 19)
Compile failure:
Vertex Shader: sh_lighting at line 8 : 'gm_BaseTexture'
Vertex Shader: sh_lighting at line 8 : 'texture2D'
Vertex Shader: sh_lighting at line 8 : '='
Vertex Shader: sh_lighting at line 27 : 'gl_FragColor'
Vertex Shader: sh_lighting at line 27 : 'assign'
Shader Code:
Code:
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform sampler2D lighting;
void main()
{
vec4 mult = texture2D(lighting, v_vTexcoord);
vec4 main = texture2D(gm_BaseTexture, v_vTexcoord);
vec4 finalcol;
vec4 lightcol;
lightcol.r = mult.r * 5.;
lightcol.b = mult.b * 5.;
lightcol.g = mult.g * 5.;
finalcol.r = mix(main.r,main.r*lightcol.r,mult.r);
finalcol.g = mix(main.g,main.g*lightcol.g,mult.g);
finalcol.b = mix(main.b,main.b*lightcol.b,mult.b);
finalcol.a = 1.;
float darkness = .4;
finalcol.r = mix(finalcol.r,finalcol.r*darkness,1.-mult.r);
finalcol.g = mix(finalcol.g,finalcol.g*darkness,1.-mult.g);
finalcol.b = mix(finalcol.b,finalcol.b*darkness,1.-mult.b);
gl_FragColor = finalcol;
}
I'm not sure if this is due to shader type & syntaxing or missing DLL's as I have read elsewhere..but considering the simple passthrough shader works I think I'm ok regarding that ..