Bah. Enough people have updated their developer's diaries that it's time for me to go and do my part.
First off, I got a whole bunch of interesting feedback from my last column. The grand total: Agreement - 3, disagreement - 3, so I guess it's a tie. I had one downright nasty piece of mail, which I won't reprint here, but the author was fairly snipey. So, today, I'm going to talk a bit about octrees since somebody asked me to, and about something else which is near and dear to my heart.
First, octrees. Somebody asked how I was using them for rapid elimination of extraneous surfaces. I'm using a frustum defined by these six equations:
x > z
y > z
x < -z
y < -z
z = (very near)
z = (very far)
Very near and very far are, if memory serves, -1.0 and -256.0. (I'm using the standard GL "mathematically correct" coordinate system -- more on this later) Then, for my octree nodes, I'm using bounding spheres instead of boxes, only ensuring of course that the world is evenly divided (I'm drawing spheres around the bounding boxes, but I'm sure that there must be better algorithms for ensuring that we don't get overdraw). So, your sphere equation is:
x^2 + y^2 + z^2 = r^2
A little stupid compare magic ensues, and you have a system which seems to be faster than slicing up cubes. I'm still working on improving this algorithm.
Second business, my stupidity. I've been working with OpenGL for about a year now, and until two weeks ago had somehow managed to go through life not knowing how the viewing frustum worked. Normally I use gluPerspective which makes it all better, but I had to use glFrustum for something (I needed to know what the clip planes were... for this octree method, as it happens!). I hacked in the code to the existing framework, and blam. Nothing happened.
Two hours later, it turns out that Z- is receding into the screen and Z+ is jutting out, not vice versa (the way that I'm used to. I'm used to doing it the way that we all did back in '95 or so where y- was the top of the screen and y+ was the bottom -- wrong handed coordinate system.. bleargh). For some reason, I went a year without knowing this.
Hmm. I wonder if I'll get to Fifth Business. Good book, BTW, I highly recommend that you read this, as well as "A Confederacy of Dunces" by J. K. O'Toole, who died before it was published by his mother. Fascinating reads, both of them.
Third business, I think I've got a job this summer, and possibly beyond, with the coolest company out there. I won't say which one until I actually start working for them. Now if I only could deal with the immigration thing. I'm a Canadian, the job's in the States, and I need to deal with all the crap that ensues. Anybody who has ever applied for a student internship from Canada to the States at a young age (in my case, sixteen) and who has gotten it please do let me know how you went about it and how you pulled those strings. So, if all goes well, by this time in July I'll be in California.
Fourth business: Game Developer's Conference. I went, it rules, go there. Ehrmm... some of the highlights: -- I got to meet Sam Lantinga, Scott Draeker, and a few other Loki folki.
OK, a Loki story. I swung by the Loki booth since I had met Sam via e-mail and wanted to talk to him in person (have you noticed how all the Loki high ranking muckamucks seem to have red hair and beards? Both Scott and Sam do, and their names both start with S. I'd better dye my hair red, get a goatee, and change my name to Simon). He was trying to get a joystick and drivers to play Heavy Gear 2 with; they'd ported it and wanted to show off the cool joystick stuff. So, he ran off to get a joystick from somebody. I played Quake 3 and proved that I still suck at it even with cool hardware. He came back from the Logitech booth bearing a fairly nifty piece of apparatus, I can't remember what. It had motion sensors in it so that you could shift the game pad around and it would move the "gear". Only: no drivers. We needed some. I found a net connection, but we still needed a floppy disk to transfer data. A mad hunt ensued. In the end, Sam got one from the Microsoft booth.
I have another Loki story, but I'll save it for later. Far too many people have heard it already.
There's WAY more, but I'll let you go next year and find out yourselves! Suffice it to say, next year I'll definitely be there again.
Blimey, this is getting too long, and I didn't make it to the important rant, so I'll cut it off here so that you'll give it your full attention, and I'll just rant on it next week. The topic: "Why OpenGL should not be used as a 2D API."