Frustum culling problem

I’m having a weird frustum culling problem. The problem is that my quadtree cells seem to pop in and out of view irregularly. The quadtree is created from a grid of cells which are created from a triangle stripped heightmap. If i draw the whole Quadtree without culling, everything is normal, but once i enable culling all goes to hell. This can best be seen by mouselooking left and right without moving from the starting position.

If someone could take a look at this and tell me what i’m doing wrong, it would be greatly appreciated.

The controls are WASD for movement, Z/C to go Up/Down and mouse for mouselook. Esc exits!

By the way, if you see anything you like in there and want to copy it, be my guest. This code ain’t very tidy but should be fairly readable.

This is a VS.NET project using ARB_vertex_buffer_objects, GLUT and Devil (

Binary: here
Source: here