Shaders Shader not picking up color from another sampler


The forum's immigrant
I am working on a very complex shader as an experiment with 3D shadering. At this point, the shader I wrote came out excellent base on my calculations. However, it is not working. I tried testing out each algorithm in the fragment shader to see which line is working or not, and I reach my conclusion where my shader is not picking up any color value from my sampler image. I tried minimalizing my code (where it only uses the sampler and the base texture alone) to see if it is the formatting that I got wrong. I tried running this short code to see if it does any changes to my screen...

uniform sampler2D render;
varying vec4 vCol;
varying vec2 vTex;

void main()
 vec4 img = vCol * texture2D(render,vTex);
 gl_FragColor = vec4(img) * texture2D(gm_BaseTexture,vTex);
It does not do anything. It shows me the screen the same as without the shader. I ask someone for help but he told me that I wrote it just fine. I dunno why it isnt working. Im using a 2D rendered image made from surface. I need to know what am I doing wrong or what possible way I can do to solve this or a way to pick up a color value from my sampler.

Im using GMS 1.4

Joe Ellis

are you setting the render sampler2D with texture_set_stage?
thats how you set a uniform sampler

also if your setting a rendered image as a texture/sampler for the shader to use, it needs to be updated every time its rendered ei. surface_get_texture

also just a side note, in
gl_FragColor = vec4(img) * texture2D(gm_BaseTexture,vTex);

you dont need to put vec4(img), as its already a vec4 so just putting img * texture2D is fine