Help with BSPs?

I’d like to use a BSP Tree in my current engine (for a game). However, all the tutorials I find come with software rasterization only.
This just ends up confusing me a ton, as I know nothing about software rasterization, nor do I wish to pursue that.

If anybody knows where I can find the source of an engine that uses BSPs that’s in OpenGL I’d appreciate it, espescially if it’s accompanied by some type of tutorial webpage or is well-commented.

C++ or C, though C++ is preferrable, as I like OO


I have some code on my webpage to generate a leafy BSP tree. The example is really simple and I tried to comment it so you should be able to use it.


The BSP-FAQ by SGI is good, I think.


Nate, I got your demo and it looks like I can learn a lot from it, but I wanted to ask you - what is the difference between a “leafy” BSP tree and a regular one?
Thanks for the code…now to sit and stare at it till I understand it

In a nodey BSP tree faces are stored at nodes. So at every node there will be a list of faces that are coplanar with eachother. In a leaf based BSP tree faces are stored in leafs, nodes with no children. So rather than storing the coplanar face in a node it is pushed down either the front or back of the current node. The faces that are stored in a leaf will form a convex hull which allows for the faces to be rendered in any order with backface culling enabled. If you need anymore help just email me and I can give you a bunch of misc links I have collected over time.