Archive for October, 2006

Apple shy of Linux?

Saturday, October 28th, 2006

You’ve all seen the ads.

“Hi, I’m a Mac.” “And I’m a PC.”

The old-fashioned PC winds up crashing or freezing, leaving the hip, cool Mac standing there looking pleased with himself.

Terminology aside, (it’s “Windows PC” — there are lots of PC OSes) Apple is ignoring what is fast becoming a major competitor: Linux.

I haven’t seen an Apple ad that even goes so far as to mention Linux. Why? Because they can’t compete. Think I’m kidding? What are all the things Apple hypes?

OS X has a pretty slick user interface. Linux has a cooler one.

OS X is easy to use. So is GNOME.

OS X is stable and doesn’t get viruses. Neither does Linux.

Hardware just works on a Mac. A good share does on Linux too. GNOME even mounts removable media that I plug in, just like OS X does.

Oh, and Linux is free. Including all of the software the average desktop user needs.

And that’s why Apple ignores Linux. If they brought it up, people would get curious about it, look into it, then wonder why they forked over three grand to Apple when they could have installed Linux on the box that they already have. It’s the same reason why companies that demo their audio codec against competitors’ never include Ogg Vorbis: because it’s better than theirs, and it’s free to boot.

C#OpenGLua

Monday, October 9th, 2006

It’s coming together slowly. Recently Kaffeeklatsch has been enhanced with Lua, which is used for key bindings and in several effects. For example, there is a “Custom” effect that simply runs a Lua script each frame. The script gets full access to OpenGL by default, but can access any loaded .NET classes. (This could be a security problem in the future, but it’s not a major concern right now.) Key bindings simply run a Lua script that is given access to the entire effect list, allowing bindings to do anything — manipulate properties and fields, and invoke methods. So a key binding can toggle multiple effects, change colors, you name it. You can also bind a different script to a key press and a key release, allowing for tap/hit effects.

Also available is an effect called SuperScope, which users of Winamp’s AVS will immediately recognize. The implementation uses Lua, and is almost completely compatible with Winamp’s implementation. With a little work, it will be 100% compatible. At first it was unbearably slow. More than 128 points with sync at 75hz (basically 128 * 75 = 9,600 points per second) would cause a significant drop in framerate. This was due to the implementation: the “point” script was compiled once per frame, and invoked n times by C#, the relevant global variables extracted, and the vertex drawn with OpenGL, through Tao. For each point. Whew.

I decided this needed to be fixed. The solution is not pretty, but it’s very effective. I moved the point loop into Lua, and wrote a small glue library in C that exposed glColor4d and glVertex2d to Lua, effectively bypassing a .NET-to-Lua call for every point — now only once per frame. I can now get up to 2,048 vertices, 75 times per second, before performance suffers.

A beta release may be coming soon. But first I need to find the source of a bug that manages to terminate mono with no stack trace after a few minutes of rendering.

Time bombs suck.