LWJGL 2D Point lighting

Okay How would create simple 2D point lighting
here is my code (no effects have been added)

VERTEX SHADER

#version 400 core

in vec3 position;
in vec2 textureCoords;

out vec2 out_TextureCoords;

uniform mat4 projectionMatrix;
uniform mat4 transformationMatrix;
uniform mat4 viewMatrix;

void main(void){
	out_TextureCoords = vec2(textureCoords.x,textureCoords.y);

	vec4 worldView = viewMatrix * transformationMatrix * vec4(position,1.0);
	
	gl_Position = projectionMatrix * worldView;

}

FRAGMENT SHADER

#version 400 core

in vec2 out_TextureCoords;

out vec4 out_Colour;

uniform sampler2D texture0;

void main(void){

	out_Colour = texture(texture0,out_TextureCoords);

}

Can you elaborate on what’s not working exactly? The program you posted (assuming it’s correct - it looks correct, but I might be missing something) just does straightforward rendering of textured geometry without any special effects, but maybe you know that and just haven’t gotten to the water simulation code yet.

In any case, some more details would probably help.

[Edit: It looks like you edited your original post, so at least some of what I wrote here is no longer relevant.]

Yeah sorry I got it working but now i would like simple 2d lighting which i cannot figure out how it works

The only thing i can find about it is this https://github.com/mattdesl/lwjgl-basics/wiki/ShaderLesson6 but i cannot figure out whats going on

OK so here’s a really simple example of lighting using a single white point light using a square attenuation model.


#version 400 core

in vec3 position;
in vec2 textureCoords;

out vec2 out_TextureCoords;
out vec2 out_WorldPos; //The untransformed position 

uniform mat4 projectionMatrix;
uniform mat4 transformationMatrix;
uniform mat4 viewMatrix;

void main(void){
   out_TextureCoords = vec2(textureCoords.x,textureCoords.y);

   vec4 worldView = viewMatrix * transformationMatrix * vec4(position,1.0);
   
   out_WorldPos = position.xy;
   gl_Position = projectionMatrix * worldView;
}


#version 400 core
#define ATTENUATION_COEFFICIENT 0.1 //fine tune to get it how you want it

in vec2 out_TextureCoords;
in vec2 out_WorldPos; //The untransformed position 

out vec4 out_Colour;

uniform sampler2D texture0;
uniform vec3 light; //x, y refer to position. z refers to intensity.

void main(void){
   float d = length(light.xy -  out_WorldPos);
   float a = light.z / (d * d * ATTENUATION_COEFFICIENT);
   out_Colour = a * texture(texture0, out_TextureCoords);

}

I HAVE NOT TESTED THIS CODE. It should give you an idea of how to go about this even if it doesn’t work.