Archive for October, 2008

a simple mvc pattern for use with gtk#

Tuesday, October 28th, 2008

Contents:

The Problem
The underlying data object
The solution: A controller class
Binding the views to the controller
Flaws?
Unit Testing
Summary

I'm going to illustrate a simple model-view-controller (mvc) pattern that I've discovered after much trial and error. Also, there is nothing specific to gtk-sharp about it, you could use it for any UI toolkit.
The Problem
According to Wikipedia, the MVC pattern [...]

Using OpenGL to interact with 2D maps, part 2: setting up

Saturday, October 25th, 2008

In part 1, I talked about mapping on the web and how it is mostly stateless. That is, a request for a map image is a single entity, unrelated to previous or future requests. Next, I discussed how mapping on the desktop is more stateful, and that we can use the knowledge of [...]

Using OpenGL to interact with 2D maps, part 1: background

Friday, October 24th, 2008

On the web, mapping is often stateless. Meaning that you get a request of what to show, then you render and return it. What requests came before or after could have no relation to the current request. A desktop client mapping application has state. In other words, as you interact with [...]

dividing integers into a double in C#

Thursday, October 23rd, 2008

A subtle bug I'll sometimes get is when I divide two integers by zero into a double variable:

int x = 1;
int y = 2;
double z = x / y;

You expect the compiler to read your mind and do the division keeping the remainder for your double, but what in fact happens is that (x/y) is [...]

Cumberland: GDI+ map rendering

Saturday, October 18th, 2008

For various reasons, using OpenGL as a 2D map renderer did not work out as well as I thought it would. Particularly:

The performance was not good. I think this is because there is a lot of overhead in setting up (and possibly tearing down) the OpenGL environment. It really was made for [...]

interactive cumberland flash demo

Tuesday, October 14th, 2008

Up until now, I have just done single 2D image rendering in Cumberland, but I went ahead and tried it in interactive 3D:
(ogg version)
Actually, it was quite easy as I just reused the code from Salmon Viewer.

adventures in unmanaged land

Friday, October 10th, 2008

First some background: I need to render polygons in my project, cumberland. The problem is that openGL can only render convex polygons, so we must convert each concave polygon into multiple convex polygons:

Luckily, GLU, the openGL utility library, can do that for you via its tessellator. Unfortunately, getting this functional in a [...]

new project: cumberland

Wednesday, October 8th, 2008

I've started a new project. It's called cumberland. It's a map rendering framework for .Net which utilizes the frame buffer extension of OpenGL to render offscreen. The idea being that you can unlock the power of your video card to render maps.
To show it off, I wrote a quick little website for [...]