spacerobot
Member
I am wondering what is the equivalent to this in GMS2:
Code:
tileIds = tile_get_ids_at_depth(targetDepth);
tileIds = tile_get_ids_at_depth(targetDepth);
//
// Simple passthrough fragment shader wih alpha multiplication
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform float alpha;
void main()
{
vec4 col = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
col.a *= alpha;
gl_FragColor = col;
}
var uniformID = shader_get_uniform(sh_alpha_multiply, "alpha")
var alpha = 0.5 + lengthdir_x(.5, current_time/10);
shader_set_uniform_f(uniformID, alpha);
var layer_id = layer_get_id("Tiles_1");
layer_shader(layer_id, sh_alpha_multiply);
layer_script_begin(layer_id, scr_layer_alpha);
It looks like you might have pasted the shader code into the vertex shader tab (the errors indicate this at least)I'm getting some errors on this in the compile window. I am attaching a screenshot. Any ideas on what this means?
//
// Simple passthrough vertex shader
//
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)
attribute vec2 in_TextureCoord; // (u,v)
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
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;
v_vColour = in_Colour;
v_vTexcoord = in_TextureCoord;
}
//
// Simple passthrough fragment shader with alpha multiplication
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform float alpha;
void main()
{
vec4 col = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
col.a *= alpha;
gl_FragColor = col;
}