Using PShader and GLSL to make swaying grass

I’m trying to add swaying grass using both a vector and a fragment shader in a 2d game, and I’m up to the point where i need to add the image to the fragment shader. Right now I’m using image() to render the image, but the fragment shader isn’t receiving the texture, I’m not very sure how it works anymore as in the rework of the processing.org website they deleted the example of PShader :confused:

Frag

precision mediump float;
precision mediump int;
#endif

#define PROCESSING_TEXTURE_SHADER

uniform sampler2D texture;
uniform vec2 texOffset;

varying vec4 vertColor;
varying vec4 vertTexCoord;

uniform float dW;
uniform float dH;

void main(void) {
    vec4 alpha = texture2D(texture, vertTexCoord.st);
    gl_FragColor = vec4(alpha.xyz, 1.0);
}

Vertex

precision mediump float;

uniform float dW;
uniform float dH;

attribute vec4 vertex;
void main() {
    vec4 newVecSet = vec4((vertex.x/dW*2)-1.0, -((vertex.y/dH*2)-1.0), vertex.z, vertex.w);
    gl_Position = newVecSet;
}

Base code

shader(sh);
image(Img, 0, 0);
resetShader();

Do you have the rest of the code please

That’s all you need, if you want the rest of the code i will have to port 8000 lines

I mean the draw method or is that long too?

Yeah lol, All of the image loading is fine, there are no issues in the base code, only in shader

It has been resolved by the discord lel, thanks for helping tho