   more heightmap woes
  Hi,   I know that this is probably the most discussed item on the forums... However, I've searched google and the forums, and read countless tutorials in an attempt to see what might be wrong with the code below, to no avail. My brain is about to shut down, could someone take a look at this and just see if I've missed anything obvious.All that happens when I render it (indexed rendering using DirectX Graphics) is a bit of a mess of polys on the screen and a really bad slow down.   //Loops through and build vertex datafor (iZ = 0; iZ < m_hLoad.iDepth; iZ++){for (iX = 0; iX < m_hLoad.iWidth; iX++){uiPoint = iX + (iZ*m_hLoad.iWidth);m_pHMap[uiPoint].fX = (float)iX * scale;m_pHMap[uiPoint].fY = (float)m_ucData[uiPoint] * scale;m_pHMap[uiPoint].fZ = (float)iZ * scale;m_pHMap[uiPoint].fDiff[0] = 255;m_pHMap[uiPoint].fDiff[1] = 255;m_pHMap[uiPoint].fDiff[2] = 255;}}bool loop = false;//Loop through the map and build the index listfor (iZ = 0; iZ < (m_hLoad.iDepth - 1); iZ++){for (iX = 0; iX < (m_hLoad.iWidth - 1); iX++){m_usIndices[uiIndex] = iX + ((iZ+1)*m_hLoad.iWidth);uiIndex++;m_usIndices[uiIndex] = iX + (iZ * m_hLoad.iWidth);uiIndex++;m_usIndices[uiIndex] = iX + 1 + (iZ * m_hLoad.iWidth);uiIndex++;m_usIndices[uiIndex] = iX + 1 + ((iZ + 1) * m_hLoad.iWidth);uiIndex++;m_usIndices[uiIndex] = iX + ((iZ + 1) * m_hLoad.iWidth);uiIndex++;m_usIndices[uiIndex] = iX + 1 + (iZ * m_hLoad.iWidth);uiIndex++;}}
  Looks right to me.Off topic: The hungarian notation made this simple code difficult for me to read.   