Shaders Image sharpen shader

jf_knight

Member
Hello.
I'm writing an image sharpening filter in GM2 and need some assistance. I'm not getting any changes on my image when moving a slider tied to "Sharpen". Here's what I have;

Code:
varying vec2 v_texcoord;
uniform vec2 resolution;

uniform float Sharpen;
void main(  )
{
    vec4 colour = texture2D(gm_BaseTexture, v_texcoord);
    float bias = floor(2.0) * Sharpen;
    vec4 b = texture2D(gm_BaseTexture, v_texcoord, bias);
    gl_FragColor = (colour + (colour-b));
}
 
Last edited:

muki

Member
what does your shader_set, shader_set_uniform_f, shader_reset code look like in the draw event? and shader_get_uniform?

also, might want to quicky try something more straightforward with the Sharpen float. like a simple multiply just to confirm the value is being updated.
 

jf_knight

Member
what does your shader_set, shader_set_uniform_f, shader_reset code look like in the draw event? and shader_get_uniform?

also, might want to quicky try something more straightforward with the Sharpen float. like a simple multiply just to confirm the value is being updated.
In the create event, I have;
Code:
sharpen_setting_UNI = shader_get_uniform(Shader2, "Sharpen");

In the Draw event I have;
Code:
shader_set(Shader2);
shader_set_uniform_f(sharpen_setting_UNI, (sharpen_setting_POSITION) );
draw_self();
shader_reset();
In Step:
Code:
sharpen_setting_POSITION = ((-1 + obj_edit_settings.sharpen_setting) + obj_edit_settings.sharpen_setting);
I've tried (Sharpen*4.0) but no noticeable change.
 
Top