Building GTK on Win32

hacking Comments Off on Building GTK on Win32

So I sat down and invested some time into building GTK 2.10 on Windows today, with help from Tor. I think Tor usually builds it on Windows using MSYS or Cygwin or something, but I managed to cross-compile from Linux and it seemed to sort of work.

There isn’t really any good and up-to-date documentation online for how to build GTK on Win32, so I made a log of every step of my process so that this can (hopefully) be reproduced by others. We’re never going to get any of the Win32-related bugs fixed if nobody can build it. :) So my next step is to start over from scratch in a different target directory and turn my log into something more concise (there are a lot of trial and error steps in my log where something didn’t work and I had to go back and try something else). And there are a few steps where I had to hack configure scripts directly, and I’d like to be able to figure out real solutions to those steps.


hacking Comments Off on Hacking

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 Comments Off on Gtk# in Windows

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;

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


hacking Comments Off on Monodevelop

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.


hacking Comments Off on BAGL

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 Comments Off on Engine hacking

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 Comments Off on Fooling around with Mono and C#

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.

Keeping my hands warm with C++ code

hacking Comments Off on Keeping my hands warm with C++ code

I always feel really cold at my office. Even now during the winter while it’s snowing outside, our air conditioners come on. I guess the office would get sort of warm with all the computers here or something, but when air conditioning comes on during the winter, I get cold. Especially my fingers and my hands. What do I do to warm them up?

Another thing we have at my company is a plugin for Visual Studio called IncrediBuild. It distributes builds across the network so that all the computers in the office will compile your code. It’s like distcc, but for Visual C++.

This really comes in handy to help my cold fingers. Whenever I get too cold, I do an often extremely unnecessary clean and rebuild of the entire project. This kicks the laptop on the left side of my desk into action, and with the extra workload its fans come on and start pumping out lots of heat through the vent on its right side. I just put my fingers up next to the vent. It’s wonderful.

Engine hacking

hacking Comments Off on Engine hacking

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 »