Skip to main content
gamedev.net
🔒 Locked

Octree Problem

Started by mattbbangin May 16, 2004 at 11:31 PM 1 replies 550+ views
Original Post
mattbbangin
mattbbangin
I''m trying to implement the Octree system from http://www.gametutorials.com/Tutorials/opengl/OpenGL_Pg5.htm . The system uses nodes that store the actual vertices they contain. However, this is not how I store my geometry. I use triangles which store 3 indices into the vertex buffer of the model. My question is, has anyone successfully done this [and did you have any specific problems with it?]? I''m so stuck, I can''t even give a proper description of what''s going wrong. Please help.
ProgramMax
ProgramMax
Well you are a bit vauge but perhaps I can help. If you wish to use your current triangle storage, the ocree needs a way to index into it.

For example, if any given node can only index into one vertex buffer, the node can store a pointer to the vb. The geometry of that node could then just store indices into the vb.

I would suggest that you also provide an index buffer for your model. The nodes could then just choose to render from x to y in the index buffer.

I hope this helped (or at least was close to understanding your problem)
mattbbangin
mattbbangin
Sorry for the vagueness.

Here''s something I noticed a few builds back...

I had a model with 4 rectangle faces; 32 vertices, 16 triangles. rootNode is built, g_maxTriangles is set to 1, and g_maxSubdivisions to 1, and subdivision begins. Now there are 9 nodes, the rootNode and it''s 8 children. Everything appears fine. But if I set g_maxSubdivisions to 2, things get screwed up. Is this supposed to happen, or is something borked?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.