Programming sucks

It would be nice if there was an easy way to do this:

XXXX
doSomething();
YYYY

Where XXXX and YYYY define a block, such as a for loop or try/catch, in such a way that you could reuse the block for other methods, and it is done in the scope of the method where you use it. As far as I know, the closest you can get is:

void wrapper(Command c)
{
XXXXX
c.doSomething();
YYYYY
}

Where c is some anonymous class. It gets less convenient when doSomething() needs to set variables. I’m sure there’s some crazy functional language that does what I want. Perhaps this is what aspects are all about, whatever the heck they are. (Or one could always use cpp <evil grin>).

mov ax, 13h; int 10h

Spurred on by that
Python hack, I’ve been getting back into graphics programming a little bit.
As it has been at least five years since I’ve dabbled, it’s interesting to
compare the way things were then and the way they are now. What a wonder
graphics accelerators (and Moore’s law) can be. Compare the first 3D
graphics hack I wrote, back in high school, which displayed a flat-shaded,
rotating icosahedron. It was written in assembly code using Mode X. You
had to tweak registers on the video card to write pixels. There was no
hardware clipping or Z-buffering or anything like that. People would
discuss endlessly on boards and newsgroups which line (DDA) or sorting
(radix) algorithms were fastest.

Five years ago, 3D accelerators were starting to appear. I got my 3dfx
card, the one with the monitor pass-through cable, in ’97 or so. I never
really tried programming for these – what little OpenGL support they had
was very spotty. Somewhere in here, I got more interested in doing
non-interactive graphics anyway. For example, there was the rigid body
simulator that 905 & I did in college
(watch the mpeg). By the
time I picked up a GeForce (which finally had a full OpenGL!), I was
doing much less coding for fun.

Today, even my laptop has a 3D accelerator in it. And computers are fast.
It’s a completely different dynamic. Go ahead, let GL do all the hard work!
The new rule is push as many triangles as possible to the card and forget
about fancy VSD or scanline algorithms.

So I’ve been messing around with the next logical step from midpoint displacement fractals: a terrain renderer.



Some things are still the same: I am reminded immediately how
frustrating pixel pushing can be when things don’t work right. The
typical bug manifests itself as an empty screen. One can go crazy meticulously
reviewing plane equations, matrix multiplications, and the like. (It doesn’t
help that I’ve forgotten a ton of linear algebra.) But with GL,
it’s a snap to do things like display the view volume with a different
camera to ferret out those pesky off-by-65536 bugs:






So, be proud, America, that you live in a land where transistors are
so plentiful!

PS I couldn’t figure out how to tie this in smoothly, but I
had to include this image for the obvious punchline:

That’s a lot of balls!

Fun with recursion

I made a pretty picture on my bus route (click for big):

For some reason noisy images don’t compress that well. It took about ten minutes to render at 800×800 from the completely unoptimized, O(2**n) python script. I’ve got nothing on fractint.

Updating the boblog

So: what has been going on lately? Not a whole lot.

Angeline and I went to Mortons last weekend to celebrate nothing in particular. While it was very nice, I still must say: ov-er-ra-ted! I had a bone-in ribeye which may have been one of the best steaks I’ve ever had, however the one at Sweetwater competes admirably and costs half as much. I didn’t tip the coat check girl, so I will probably go to hell.

You heard it here first: SD is going to be in the Jaxx Battle quarterfinals. Plan to be there, because our draw is historically pretty poor and it would be really nice to qualify (26 votes). Right now the word is we play August 25th.

A complimentary e-mail from a random internet robot forced me to review some code I wrote long ago. Here it is:


for (i=0; i<FNHEIGHT; i++) {
font_bitmap = *(font_index + i);
for (j=0; j<FNWIDTH; j++) {
bit = 1 << (FNWIDTH-j-1);
if ((font_bitmap & bit) != 0) {
framebuf[ width * FNWIDTH * (FNHEIGHT * y + i)  
x * FNWIDTH + j ] = fgindex;
} else {
framebuf[ width * FNWIDTH * (FNHEIGHT * y + i)  
x * FNWIDTH + j ] = bgindex;
}
}
}

Poor bracing style aside, I really miss C. Seriously, remember when the only tools you had to use were vi, gcc and make? As opposed to vi, xdoclet, ant, and javac, three of which suck. I’ve been thinking a lot about computer languages — why we like the ones we like, why we hate all of them to at least some degree. Then, my metamind starts wondering why I am thinking about computer languages rather than thinking about the problem at hand, and how this is probably indicative of some universal shortcomings that they all share. Or maybe I’m just goofing off at work. So, in summary, use Perl.