After Christmas hangover
… Not really. As much as I wish this was all some hallucination, I am in fact in the Wichita airport, tired and an hour away from a flight to Dallas, followed by a flight to Atlanta, and topped off with a 3 1/2 hour drive to Savannah. Somebody shoot me.
Time spent with the family is totally worth the trip, though. I so rarely see my folks anymore, and it’s nice to be fed and to load up on books and nice things to wear. It has been snowing in Kansas; something that is still novel to me. In the South, we believe ‘hard water’ is a man-created thing, fashioned out of the need to cool one’s beer, and certainly not something that simply falls from the sky. Dad apparently drove into a snow drift the other day and had to be dislodged by a better equipped passerby. He claimed he had been caught in a ‘white out’ of arctic magnitude - three meters from the Target entrance. Okay, Dad.
I’m very much looking forward to being home again, and to picking up Iterator from the kitty hotel. I have a few days before the other half of my family arrives for New Years.
There are still some rather large loose ends I need to tie up after the work Dave and I did on the code base. The new background loading system which we implemented has opened a whole new can of worms. As it turns out, the Windows OpenGL implementation’s rendering context is thread locked. When a scene is loaded in the background, it has to initialize new textures and VBOs with the rendering context, which belongs to the rendering thread. This means that I’ll either have to switch ownership of the context between threads when something is loading (bad) or defer initialization of OpenGL dependent objects (meshes and materials) and load them in the rendering thread when it isn’t rendering (also bad). This is all really dumb. When writing this kind of thing on the Mac, you can manipulate a GL context from whatever threads you want, provided you set up your critical sections correctly. Windows is dumb.
On the plus side, I’ve refactored each class’s Lua initialization code to register with the script system using a pre-main initializer, and have rearranged things such that each new Actor instance has its own Lua state, which shares a global table with the script system’s main Lua state. Prior to this, I had a single global Lua state which was shared by all Actor instances. This fixes a problem I was running into when trying to add new Actors (and their scripts) in a background thread using the same Lua state being executed in another thread. Only one Lua state per thread. Always.
Enough rambling. I have a plane to catch. See you in Savannah!!