Jump to content
  • Advertisement
Sign in to follow this  
d1223m

another octree question

This topic is 4734 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

hi, im trying to make a level exporter. my plan is to make an octree with all the polygon data stored in the leaf nodes. so far so good. iv got this working with simple glVertex calls. next im thinking i should put all the vertex/texcoord data into a vertex array ( and then VBO ). so i can store an array of vertex index's for each polygon instead of the actual vertex. now iv read a lot about state changes being bad. at the moment i have a material id for each polygon. this is where i start to get confused. should i go thru my octree collecting polygons to draw without actually drawing them, sort them by the material and then draw them? perhaps sorting that many faces would be bad. as i said, i get confused here as whats best. any help much appreciated dunk

Share this post


Link to post
Share on other sites
Advertisement
What I've done is create an array of 'all' triangles in the gameworld. These are sorted first on material and secondairy on octnode. In my culling structure (which might be an octtree but is a combination of an octtree and a POV structure) I have stored references to the elements of the array.

Each frame I find the visible triangles (using the culling structure) and mark the visible triangles in the array with the current framenumber.

Then I loop through the array finding a 'batch' of triangles with the same material (because of the sorting they are allways next to each other) and set the material and then draw the batch.

It is actually a bit more complex than this because I do not really store the triangles but I use indexbuffers.

Cheers

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!