60-hz / Ofelia-Fast-Prototyping

Some abstractions that helps prototyping projects with the ofelia library and pure data
27 stars 2 forks source link

Lighting abstractions: Initialization bug #2

Open jamshark70 opened 3 years ago

jamshark70 commented 3 years ago

In pointlight, spotlight, and the other similar light sources, I get an error about accessing a nil item when creating an instance.

It looks like M.setup() is called at least once before the window is created. At that time, the setup function won't create the ofLight object -- but then its logic is of the form:

I can think of two solutions:

In my revisions, I did the first. If the second is better, that would be ok too.

60-hz commented 3 years ago

Thanks, that's true. I also removed the light:disable() causing an error when the object was removed. Anyway, lights are a bit confusing and sometimes unstable.