4

Are there any tutorials or articles on how an efficient lighting system can be done in Java, using LWJGL?

As far as I know, LWJGL supports 8 or 11 lights (I can't remember without looking into the code) and I am interested in how this can be used to actually make a proper use of them, to easily distribute them in the world and manage the lights. Maybe there is a library for this?

I am also interested in any techniques to do shadows using LWJGL.

genpfault
  • 51,148
  • 11
  • 85
  • 139
Myzreal
  • 351
  • 4
  • 16

2 Answers2

1

LWJGL essentially gives you a java binding for OpenGL. And the number of light sources supported varies between hardware. To find out, your program needs to get GL_MAX_LIGHTS:

int lights = GL11.glGetInteger(GL1.GL_MAX_LIGHTS);

If you want to look up articles on lighting in LWJGL, just look up articles that cover the same topic using OpenGL.

Remember you can use the OpenGL site to get better explanations of all of the various functions. Just ignore the C-specific parts.

Michael Slade
  • 13,802
  • 2
  • 39
  • 44
-1

Lighning and the amoung mapping technologies (normal mapping, shadow mapping) are one of the most complex graphic topics in terms of calculation, ...

There are several tutorials online.

One good tutorial is for example: http://learnopengl.com/#!Advanced-Lighting/Advanced-Lighting

It is not LWJGL but this is also not important as you mostly use the Vertex, Fragment and Geometry shader for the rendering and I've you go through all of the tutorials you will get a very good overview of quit advanced graphic topics. Most of the C code can be shipped easily to LWJGL.

I don't recommend you the various youtube channels (thebennybox, thinmatrix) for learning opengl (lwjgl) as you will just type everything down line for line by their tutorials. Of course you will get from them a good overview how certain things are working but don't code your game based on the tutorials.

Some other sources:

  1. Very intense lighning tutorial: http://www.falloutsoftware.com/tutorials/gl/gl8.htm
Greasy Fox
  • 41
  • 3