Public Group

# Need some help with my quadtree

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

## Recommended Posts

Well I've got my heightmap data into a quadtree. Now i'd like to do some simple culling. My plan is to have a recursive function that take in an axis-aligned rectangle and a nodeid. with the function in the form of:(pseudocode)
void CullbyRect(boundingRect, nodeid)
{

static Uint currentVert;
{
{
//add data to a list of sorts, problem A.
}
else //its not a leaf
{
//etc...
}
}

}

The problems im having are: Not sure howto calculate how many leaves(or node) would be visible for a given bounding rect. and I can't figure out howto store and move the data, right now im storing it in the leaves of my quadtree and memcpy'ing it out which is an access violation nightmare for me. I was thinkin storing only indices to a master array of sorts in the quadtree, is this a better solution? Edit: I have a few somewhat related Q's so ill ask them here. Are there any real benefits to using triangle strips as opposed to quadstrips? Are strips faster than full primitives significantly(it seems it should be since the amount of data is reduced)? Im using opengl btw. I also have some ogl questions, Ill probably start a thread about them in OpenGL subforum. Between glDrawArrays() and glInterleavedArrays() which is better(coding time/difficulty not important) and if ya could whats the point of glInterleavedArrays.

##### Share on other sites
Hi,

Use a std::vector and push back the list of indices into the node once u know they exist. This should solve problem A. However if you seperate indices for normals, textures and vector then its a different story.

With glInterleavedArrays you can specify everything at once - ie color, vertex, normals etc. However I think glVertexPointer, normalPointer etc and glDrawElements allow for more flexibility.

• 10
• 48
• 12
• 10
• 10
• ### Forum Statistics

• Total Topics
631383
• Total Posts
2999680
×