Hacking

hacking No Comments

I’ve been getting back into Gnome related technologies recently, for variousreasons. I started looking into Gnome’s accessibility project, like ATK and atk-spi. It’s pretty cool, I think. I had long ago started to work on a speech recognition interface for Gnome using CMU Sphinx and a Bonobo interface. It never got further than occasionally being able to recognize when I say “hello” and display a popup “Hello, world!” dialog. But it was cool.

Gtk# in Windows

hacking No Comments

I’m hacking on my Gtk# app in Windows right now, because Visual Studio is amazing. I
couldn’t seem to get pixbufs to load from relative paths, because I couldn’t figure out what the present working directory is on anything in Windows, so I started fooling with the resource manager.

This is a very cool thing. You can put strings or images or whatever you want in there, then access it from your app as Properties.Resources.Foo. Very nice.

However, if you’re using images then they’re obviously stored as a System.Drawing.Bitmap, and Gtk# wants to deal with things as a Gdk.Pixbuf. So here’s a quick snippet of code to deal with that:

using System;
using System.Drawing;
using System.Drawing.Imaging;

public Gdk.Pixbuf CreateFromResource( Bitmap bitmap ) {
BitmapData data = bitmap.LockBits( new Rectangle( 0, 0,
bitmap.Width, bitmap.Height,
PixelFormat.Format24bppRgb );
IntPtr scan = data.Scan0;
int size = bitmap.Width * bitmap.Height * 3;
byte[] bdata = new byte[ size ];

Gdk.Pixbuf pixbuf = null;

unsafe
{
byte* p = (byte*)scan;
for( int i = 0; i

Monodevelop

hacking No Comments

So I started testing out Monodevelop for hacking on my resurrected Ludwig van. It’s pretty nice, I think. Obviously it’s pretty far from Visual Studio, but it’s not bad. The big new thing in the latest release is the integration of stetic, the user interface builder.

Maybe I’m retarded, but I just can’t ever seem to save time by using these UI builders. Glade was okay, but so far I can’t figure out how to use stetic in any remotely useful way. In this respect, I don’t feel that Visual Studio is much further along because its UI builder is pretty useless too. But as I said, maybe I’m just retarded.

BAGL

hacking No Comments

A few days ago I started working on a new GObject-based framework for doing general stuff on the GPU. It’s in the very early stages so far, and basically allows render-to-texture and readback of the textures. It’s not very portable yet, in a couple different ways. Right now the test programs require X11, and won’t work on Windows or Mac. That’s pretty minor, is easily fixed, and doesn’t really matter that much anyway. It’s also not very portable between different types of video cards yet, since it depends upon FBOs (and makes use of PBOs if they’re available). And while I was at it, I don’t check for support of rectangular, non-power-of-two textures since any video card that does FBOs and PBOs will also support that. So, basically this code will currently only run on NVIDIA cards.

I’m just now about to start working on the shader support. There are two possible approaches here. The first is to find the best existing shader and use it. The second approach is to have some general data structure describing the shader, select a shader target, and generate the source for it (GLSL, HLSL, ARBvp/ARBfp assemblies, etc) at runtime. This is sort of
what libsh does, although since it’s a C++ template metaprogramming library it generates the source at compile time. The obvious advantage of this approach is that you jump through a few extra hoops to write your shader, and it gets generated into any target you want and you don’t have to write it multiple times. The obvious disadvantage is just that it’s hard to implement, and that it conceivably doesn’t generate the highest-performing shader code. For my purposes, I don’t necessarily need the highest-performing shader code so this isn’t a problem. However, I also don’t care that strongly about the multiple targets. I’d be willing to write one shader a couple times to support different GPUs if necessary (e.g., one shader for SM3.0 and one for everything else). Also, I’d rather go with the easier-to-implement approach so I can have something working sooner rather than later.

This is my first step to World Domination!

Engine hacking

hacking No Comments

I finally got my first engine update in a long while into the cvs server. Hardware occlusion queries are now implemented for Direct3D and for OpenGL. I’ll get a nice looking test program into cvs soon as well.

Right now I’m hacking on support for Xinerama multiscreen displays in Linux so that the device enumeration will be more sensible. Right now it’s detecting my system as a single 3200×1200 display rather than two 1600×1200 displays. One thing that’s really impressive is that I don’t notice much of a performance loss when it’s rendering across two monitors like that. I haven’t tried it in Windows yet, but I know that using Direct3D you’ll instantly get forced into software rendering mode if you use the second monitor (whether you’re spanned across the two monitors or not).

Fooling around with Mono and C#

hacking No Comments

I’ve been fooling around with C# some more. Microsoft sent me a copy of Visual Studio 2005 beta 2 on DVD recently, and I’ve been using Mono on Linux. I’m really interested in getting back to work on some music notation goodness, but this time using a better language. There’s no way I’m going to try to use C. That’s just stupid.

I’m totally cool with using C++, but everyone else I talk to thinks that’s completely insane. I have no interest at all in using Java, and I am wanting to avoid using something like Python as well. I don’t really know why that is. In every other language binding, GTK has really felt like just a “language binding” between C and whatever language it is. For some reason, Gtk# feels more integrated.

Engine hacking

hacking No Comments

Support for OpenGL Shading Language went into cvs several days ago, and it’s working perfectly. I’m happy that’s done. I started working on a command-line utility for working with chunk files and needed a nice way of doing argument parsing, so I started working on a template-based method of handling them yesterday. There are still a couple things in the design that need to be worked out, but it’s mostly very good now I think. It fits very well with the existing application framework too.

Next Entries »