1
\$\begingroup\$

I'm working on a 2d top down game with libgdx and I think i got the basics. No want I want to implement lighting, I don't know anything about lighting. I want just to have some light sources and shadows, but how do i do it?

Is using glsgl the only wayto do lighting in a 2d game? I've already tried to learn opengl and gave up because i thought it was too dificult and could take too long to do something even if i got the basics. Mabye glsl is different anyways

Any examples/tutorials would be welcome. Thanks in advance

\$\endgroup\$
1
1
\$\begingroup\$

There are ways to do dynamic lighting without shaders, although they're usually not as efficient. They often involve raycasting. The link below has some links to useful resources regarding dynamic lighting.

http://www.java-gaming.org/topics/2d-dynamic-lighting/27012/view.html

\$\endgroup\$
2
  • \$\begingroup\$ what do you mean by "not as effecient"? \$\endgroup\$ – twkmz Mar 3 '15 at 14:21
  • 1
    \$\begingroup\$ Since shaders are run on the GPU, which has much faster memory and can perform mathematical operations a lot faster and output it to the screen. This is one of the reasons shaders are more popular than other methods, like drawing to a surface and subtracting/adding the appropriate areas. \$\endgroup\$ – DingusKhan Mar 3 '15 at 14:39
1
\$\begingroup\$

If you're also working with box2D, you could try box2Dlights, it's a pretty nice wrapper and it's easy to implement as well.

\$\endgroup\$
2
  • \$\begingroup\$ isn't it java-only? \$\endgroup\$ – twkmz Mar 4 '15 at 15:20
  • \$\begingroup\$ I'm not really sure, but you posted in the java category so that shouldn't really be a problem \$\endgroup\$ – user62368 Mar 4 '15 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.