Wednesday, July 1, 2009

Cross platform inkcanvas yay


Well, you probably figured I was full of shit. I did, and I have first hand knowledge. Regardless, I've managed to overcome it for a bit, and this is a Java+JOGL+JPen InkCanvas, WPF styles. First things, first, the proof in the pudding:

Here are the ways in which I discovered that I am very stupid during the execution of this project:

  1. My trigonometry is for the birds, even worse than my ornithometry. It took about four or five days of Stu and I fiddling to discover that while we may have some clue about the basic principles there's a whole black hole waiting in arctangentry. Once we figured out what the problem was and started to google it, the first result was about atan2 (found in all good programming languages near you), and substituting that for atan basically fixed all the problems straight away.
  2. It still doesn't look quite as nice as WPF. Fairly close though. We're polling 90 times per second with about a 1% overrun, so the machine's capable of handling it. I'm doing simple quads, so if you zoom in far enough it's all chunky angles instead of nice smooth nurbs or whatever. WIP, bite me.
  3. Texturing is going to be a timesink like no other. Not just executing it (although that's a fairly new area), but tinkering with it - basically I just want the ink to bleed a little at the edges of each stroke for greater realism. Trouble is, that makes alpha blending important and I think it might be slow.
  4. I have absolutely no idea whether it's faster to do my own trig on the CPU or glTranslate such that I always draw the quads pointing in the same direction and let the coordinate system work it out.
Welp, that's where I got to. Just figured I would write it down so that when I accidentally delete my code there'll still be some evidence somewhere.

ps. I just read the previous post and realised I should fill in the blanks: I'm auditioning DarkStar as the server architecture (which is why I'm fiddling with Java and JOGL), and am going to fiddle with using gluegen to link Awesomium into Javaland. No more C, unless there's a genuine performance reason (Java in the 21st century pretty much sneered just then and told me that there wouldn't be). Whatever, Java. I love your virtual machine, but man do I hate fucking typing you in. Even Netbeans joy doesn't make up for your carpal tunnel causing verbosity. Sidenote: I am a horrible person for laughing that Gosling has carpal tunnel. But man, is there poetic justice in this world, or what? I bet Rich Hickey doesn't have carpal tunnel. Aaaanyway... Sorry, James, if you're listening. I like your Hotspot compiler. I just wish you hadn't backed off of decent closures.


No comments:

Post a Comment