I'll admit that things have gotten off to a bit of a slow start, but I got a good solid many hours in today, to the chagrin of my wife I think, and have made some definite progress.
I got over my separation anxiety from Visual Studio and have been enjoying sublime pretty well. Still haven't figured out the hotkeys, and Suresh tells me there's one to switch between headers and source code. Gotta make that the first one to find.
So the game! Boy, was debugging that frustrating. I eventually got it all to compile (although I had to turn off DISABLE_IMPORTGL (which makes sense... but then it is defined in the demo code I was referencing) and rewrite the import functions in my own code and just return dummy values (no idea why they wouldn't link across files. Some sort of deadstripping gone crazy?) And then after that it took me a few hours to figure out the Dynamic function loading was failing, and that specifically I had the following problems:
- The functions were the wrong name. They needed to spell out the package domain and be case sensitive so the JNI can find them. A-ha!
- If the functions are going to be in compiled in C++, then they need to be forward declared as extern "C", because the JNI isn't going to find them if they have C++ mangled names. Whoops.
- When making new JNI functions, you really ought to have the first two arguments be pointers to the JNIEnv and the Java's this, because that's how JNI is going to call them. Whoops.
So, I put it all together and I've got input being generated in Java and passed to C, and similarly render calls generated in Java being passed to C, where they're implemented in OpenGL. So far, not much going on rendering-wise, but I use the input values to set the clear color.
Behold!
Ignore the trails on the mouse cursor there; that's just an artifact of the encoding process.
Speaking of debugging being a nightmare: I have no idea how to use GDB. I've been having some difficulty getting it to connect to the process at all, and once I get in: what then? I can't imagine debugging through a command line; it sounds extremely painful.

Leave a comment