Not directly ogl related: Visibility using trees.

In a bsp, octree or quadtree all trees have an amount of children. But you can’t change the amount. Therefor if I want a tree that looks something like this:

               root
                 |
       +---------+-------+
       |                 |
  +--+-+--+-+        +---+---+
  |  | |  | |        |       |

I’ve tried to do this using an integer value
in each node to process each child but it becomes incredibly slow. Isn’t it possible to in each node have a pointer to a function to process the current kind of node?
Or how to do?

Not sure on your question but I’d use the CODE tags when I want to illustrate something like this:

               root
                 |
       +---------+-------+
       |                 |
  +--+-+--+-+        +---+---+
  |  | |  | |        |       |

This is not opengl related, but what the heck.

Why not have just have a dynamic array/linked list at each node storing its children. (or pointers to it)

(In c++, that would be a std::vector<> or std::list<> )

That’s what I tried.

I’m not sure if this is a correct solution because I have not had time to test it but whould it work if I did like this:

class t_Node
{
t_List<t_Node> children;
void __cdecl * correctMethodForThisone;
};

class t_Tree
{
t_Node root;
};

But how should I code that?