Original Post
I am trying to tackle 2d lighting in a new game I am coding. Is it possible to implement it using SurfaceView without OpenGL?
My idea on how to implement it is to cast rays between two angles. As the ray goes down the line, it intensifies the pixel it is over by a certain fade value. If it collides it stops, otherwise it keeps going until a fade value hits 0;
I have never done something like this before (my last games were just regular 2d puzzle/tile games) so it probably is the wrong way to approach this. Two problems I find is
Modifying the pixel: As far as I know there is no way to modify the back buffer in Java correct? Otherwise I'd just run this over whatever was stored there after all tiles and objects were rendered. The other option is to pre-calculate it on the resources before drawing it.
Second problem is it looks like it will be real slow if it is calculated dynamically.
So how would I do this?
My idea on how to implement it is to cast rays between two angles. As the ray goes down the line, it intensifies the pixel it is over by a certain fade value. If it collides it stops, otherwise it keeps going until a fade value hits 0;
I have never done something like this before (my last games were just regular 2d puzzle/tile games) so it probably is the wrong way to approach this. Two problems I find is
Modifying the pixel: As far as I know there is no way to modify the back buffer in Java correct? Otherwise I'd just run this over whatever was stored there after all tiles and objects were rendered. The other option is to pre-calculate it on the resources before drawing it.
Second problem is it looks like it will be real slow if it is calculated dynamically.
So how would I do this?