So awhile back i made a shadow caster. To simulate 2D light i use a radial gradient but when the radial gradients overlap they dont bleed into each other.
[media]
[/media]
So my question Is: is there a way to make the multiple light sources bleed into each other?
In this Example it shows how i want the light to merge together to form a new color.
Example of blending light:
[media]
[/media]
I asked a question similar to this in the openGL section but nobody answered it.
Heres what the Main draw method looks like:
public void display(GLAutoDrawable drawable) {
GL gl = drawable.getGL();
gl.glDepthMask(true);
gl.glClearDepth(2f);
gl.glClear(GL.GL_COLOR_BUFFER_BIT |GL.GL_DEPTH_BUFFER_BIT );
gl.glEnable (GL.GL_BLEND);
gl.glBlendFunc (GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
gl.glDisable(GL.GL_CULL_FACE);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();
setCamera(gl, glu,Distance);
for(int J = 0 ; J < ray.length ; J++){
ray[J].RenderLight(gl);
for(int K = 0 ; K < shape.length;K++){
shape[K].RenderShape(gl,ray[J]);
caster.getCastPoints(shape[K], ray[J], gl);
shape[K].ClearLists();
}
for(int K = 0 ; K < shape.length;K++){
shape[K].RenderShape(gl,ray[J]);
shape[K].ClearLists();
}
}
try {Thread.sleep(30);} catch (InterruptedException e) {e.printStackTrace();}
}