libgdx / box2dlights

Fork of box2dlights by Kalle Hamalainen
Apache License 2.0
257 stars 82 forks source link

[Feature Request] Add a way to specify a glClearColor different than black #105

Closed hbar-boi closed 3 years ago

hbar-boi commented 7 years ago

Hello devs and first of all thanks for this great library! I wanted to know whether it was possible to give a Color to RayHandler to be used as glClearColor (therefore the parts of the world that aren't illuminated). I tried using setAmbientLight but this doesn't work because it shows some bodies that I wanted to keep invisible unless some kind of light is shined at them (not the ambient one). I tried fiddling with the RayHandler file and found the line Gdx.gl.glClearColor(0f, 0f, 0f, 0f); in the render() method and I guess all it would take is to have a variable instead of fixed 0f values. What do you think? Thank you again

rinold commented 7 years ago

Hi @pippogeek ,

The AmbientLight is the one and only for unilluminated area. The glClearColor you point - is actually not black - it's an absolutely transparent color, and used for different purposes (if you change it it would be blended with all the lights you have i think).

So, could you please show example (at least a screenshot) with details describing the "setAmbientLight doesn't work"? Setting it to black should hide everything that is not illuminated. If you have some bodies, that should be still visible (with non opaque black ambient) and some not - you should test (e.g. using RayHandler pointAtLight method) this specific bodies and toggle thier visibility manually.

crykn commented 3 years ago

I'm closing this, considering the age of the issue and because the proposed use-case doesn't seem to have been valid in the first place.