   Quadtree offset problem + solution = crash.
  I finally came up with decent way to make offsets for each quadnode so that there are no cracks in the map. However there is only one problem. When the last node comes into view, the program crashes. Sometimes I can see the node, sometimes not.Download here to see what happens: www.suicidesolutions.com/fos3de.zipI''ve been pummeling with the problem for a day now, and I have no idea where to seek for the solution. Since I don''t go over the array(?). Here is how I calculate the offsets:   int Quadtree::getOffset(int oldOffset, int width, int nodeID){    int offset;    switch(nodeID){   case TOP_LEFT:  offset = oldOffset;   break; case TOP_RIGHT:  offset = oldOffset + width;   break; case BOTTOM_LEFT:  offset = oldOffset + (width*terrain->size);   break; case BOTTOM_RIGHT:  offset = oldOffset + (width*terrain->size) + width;   break;    }    return offset;}and here is how I test what to render: void Engine::drawQuadnode(Quadnode* node){    Vector3f center = node->bbox.center;    float &width = node->bbox.width;    float &height = node->bbox.height;    if(frustum.boxInFrustum(center.x, center.y, center.z, width, height)){   if(node->subDivided){  drawQuadnode(node->childnode[0]);  drawQuadnode(node->childnode[1]);  drawQuadnode(node->childnode[2]);  drawQuadnode(node->childnode[3]);   } else {  drawTristrip(data, node->offset);   }   }}here is how I render:   void Engine::drawTristrip(Terrain* terrain, int offset){    glPushMatrix();    glEnableClientState(GL_VERTEX_ARRAY);    glEnableClientState(GL_COLOR_ARRAY);    glVertexPointer(3, GL_FLOAT, sizeof(Vector3f), terrain->vertices+offset);    glColorPointer(3, GL_FLOAT, sizeof(Vector3f), terrain->colors+offset);    glDrawElements(GL_TRIANGLE_STRIP, terrain->numIndices, GL_UNSIGNED_SHORT, terrain->indices);    glDisableClientState(GL_VERTEX_ARRAY);    glDisableClientState(GL_COLOR_ARRAY); glPopMatrix();}I''m really in a hurry, since I have one week to complete this and implement my friends genius lod + write a report on it. I''d appreciate some help. I''m sorry if I come out as moron.Of course if anything decent comes out of the lod, it will be public domain 
  I found the problem, where as the offset of the last node should be 1015808 it is 1016800, somehow my algo is flawed. Back to workbench. Meanwhile, can anyone spot any major flaws in the method I''m using? ;  Actually my algo was fine, however my indices were wrong, they were 1 too big, since 0 also counts in an array, now I got huge cracks http://www.suicidesolutions.com/cracks.jpg 