PDA

View Full Version : Octree



Halcyon
11-26-2002, 08:29 AM
Ok i've been looking around at what an octree is and how it works. I think i've got most of it down, but i have no idea how you can figure out how many polygons are in each node! I mean say you draw two squares with




glVertex3f(0.0f,0.0f,0.0f);
glVertex3f(0.0f,1.0f,0.0f);
glVertex3f(1.0f,1.0f,0.0f);
glVertex3f(1.0f,0.0f,0.0f);
// Draw square translated 3 units back
glVertex3f(0.0f,0.0f,-3.0f);
glVertex3f(0.0f,1.0f,-3.0f);
glVertex3f(1.0f,1.0f,-3.0f);
glVertex3f(1.0f,0.0f,-3.0f);



How would you know how many quads were in a node...because once you draw that square you dont' have the coordinates in any variables. Do you have to do any raycasting to test how deep it is? Sorry i'm a total newbie at this stuff. I've only learnt opengl up to texturing and i'm just checking out what you can do as you progress. http://www.opengl.org/discussion_boards/ubb/biggrin.gif

Thanks all for the responses!

-Halcyon


[This message has been edited by Halcyon (edited 11-26-2002).]

[This message has been edited by Halcyon (edited 11-26-2002).]

rborob
01-24-2005, 01:22 PM
dont quote me on this but have you got an indexing method for your octree structure? how many voxels are in each cell and how many altogether? is it 128x128x128? ive used octree in the past and its a lot more complicated than mentioning 2 cubes im afraid

dvm
01-24-2005, 02:06 PM
I've no idea about octrees, but maybe it pre-supposes that you have a model file somewhere, so you know how many vertices etc. you've got. Just an idea.