• Advertisement
Sign in to follow this  

Efficient way to render an octree

This topic is 4950 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm coding a 3D engine based on octree. For now, to render an octree, I just traverse each node, I determine whether it's visible or not, and then, I draw it. But this is not very efficient. So, I thought to store a vertex buffer in the root node, for each texture, which contains all the vertices of the same texture. In my node, I just store vertex indices. To render it, when a node is visible, I 'memcpy' vertex indices of the node into a larger 'index buffer'. Once all the nodes have been traversed, I render the octree using the new index buffer, for each texture (calling glDrawElements). But this is not yet very efficient :( It is because I use memcpy? or because, when I call glDrawElements, there are vertices in the vertex buffer which don't need to be here (invisible vertices)? How do you render efficiently your octrees?

Share this post


Link to post
Share on other sites
Advertisement
One method is to use a render queue. When you find a visible node, add it to a list of things to render. The render queue is then sorted, based on shader/render states and so forth, and flushed. I've found it to be quite an efficient method...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement