   VBO and heightmap
  hey all. I want to load heightmap of type ".bmp" into my scene using vertex buffer object. The thing is from what i got from nehe tutorial the scene is loaded successfully but using gldrawarray. I want to load the scene as gldrawelements to improve performance more. The problem is how can i get the index array for each vertex loaded from heightmaps. I tried google but nothing, can someone help. tnx in advance...   
  Assuming each quad is build the same way, just put the vertices into your VBO, setting y to the heightmap value. Then build an index buffer with 6 x num_quads indices and fill them, for example by iterating over each quad, like this:for(int x = 0; x < (width - 1); x++){ for(int y = 0; y < (height - 1); y++) {   //add index y * width + x   //add index y * width + (x + 1)   //add index (y + 1) * width + x   //add index (y + 1) * width + x   //add index y * width + (x + 1)   //add index (y + 1) * width + (x + 1) }};  tnx for the reply. actually i'm drawing triangles not quad and as u were saying its for quad. i'm working according to the sample of nehe leson 45: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=45IMO the index should be implemented in this code but i don't know how. hope you can help.for( nZ = 0; nZ < m_pTextureImage->sizeY; nZ += (int) flResolution ){for( nX = 0; nX < m_pTextureImage->sizeX; nX += (int) flResolution ){for( nTri = 0; nTri < 6; nTri++ ){// Using This Quick Hack, Figure The X,Z Position Of The PointflX = (float) nX + ( ( nTri == 1 || nTri == 2 || nTri == 5 ) ? flResolution : 0.0f );flZ = (float) nZ + ( ( nTri == 2 || nTri == 4 || nTri == 5 ) ? flResolution : 0.0f );// Set The Data, Using PtHeight To Obtain The Y Valuem_pVertices[nIndex].x = flX - ( m_pTextureImage->sizeX / 2 );m_pVertices[nIndex].y = PtHeight( (int) flX, (int) flZ ) *  flHeightScale;m_pVertices[nIndex].z = flZ - ( m_pTextureImage->sizeY / 2 );// Stretch The Texture Across The Entire Meshm_pTexCoords[nIndex].u = flX / m_pTextureImage->sizeX;m_pTexCoords[nIndex].v = flZ / m_pTextureImage->sizeY;// Increment Our IndexnIndex++;}}};  Sorry for being a bit unclear. Saying "quad" I meant a quad made of two triangles, like so:+---+---+|\  |\  || \ | \ ||  \|  \|+---+---+|\  |\  || \ | \ ||  \|  \|+---+---+(4 quads)You can use the code below to fill the VBO, just call the code inside the for( nTri = 0; nTri < 6; nTri++ ) loop only once. I'd also suggest incrementing nZ and nX by 1 (i.e. use flResolution = 1.0f), for sake of simplicity.Then build the index buffer using the method I outlined above.It might help to do some manual calculations on a piece of paper to get an understanding of what's going on [smile].   ;  tnx alot, its clear now :).   