Original Post
I'm thinking of implementing octrees in my engine. I know the concepts, but I have never seen an actual implementation, so I'll show you my ideas, so you can tell me where it can get better. -I build the level in 3d studio max -in the exporter, I create an array of triangles and fill it with all the useful info (including the texture they use); i create a big array of vertices, too. -I recursively subdivide the level, working with the triangles --if a triangle intersects the bounding box of a node, the node stores a pointer of it --if there are too many triangles in the node, it is splitted, and the polygons are passed to the children nodes; this way only the leaf nodes contain triangles. -In my engine I load the level. I get two arrays (one of triangles, the other of vertices) and the nodes information -I create a vertex buffer and fill it with the vertex array, and create some dynamic index buffers, as many as the textures used. [Every Frame] -I set the big vertex buffer -I cull the nodes with the frustum planes, so I know what nodes need to be drawn -loop trough every node that has to be drawn --loop trough every triangle of the node ---(only if it is not flagged) write the indices of the triangle to the corresponding index buffer (depending on the triangle texture) ---flag the triangle as drawn -for every index buffer --set it --set the corresponding texture --draw -remove all the flags from the triangle list.. what do you think? is it going to work well/run fast? especially since I already get high framerates (180FPS) drawing the entire level (but it is still far from being complete, so the triangle count is still low) thank you for you help!