   Heightmap: What am I doing wrong?
  I''ve been trying for 2-3 days now to get a heightmap based terrain renderer working. I''ve finally got it to draw the heightmap properly, after borrowing some code from DigiBen over at GameTutorials.com. However, I still have a couple of problems:1 - When the image for the heightmaps get to big, I simply get one large flat plane as my result.2 - The bottom-right corner of the rendered heightmap always has some erratic heights, eg. the bottom right corner, and the surrounding area are much higher than those arround them.My rendering code is included in this post, if it helps. Any help will be greatly appreciated.   for (x = 0; x <= map_breadth; x++){if (goback){for (y = map_width; y >= 0; y -= 1){glColor3f(0.0f,0.5f,0.6f);glVertex3d(x, (int)data[x+(y*map_width)]/10, y);glColor3f(0.7f,x*0.1f,0.6f);glVertex3d(x+1, (int)data[(x+1) + (y*map_width)]/10, y);}}else{for (y = 0; y <= map_width; y += 1){glColor3f(0.0f,0.5f,0.6f);glVertex3d(x+1, (int)data[(x+1) + (y*map_width)]/10, y);glColor3f(0.7f,x*0.1f,0.6f);glVertex3d(x, (int)data[x+(y*map_width)]/10, y);}}goback = !goback;}
  is your data array (map_width+1)*(map_width+1) big? otherwise you might be getting values outside the boundaries of your array. ;  it''s determined from the bounds I give it, so for a 100x96 map, I give it the value 100x96 is this OK? or should I make it bigger? ;  use heightmaps of size (2^n + 1) * (2^n + 1) so each pixel represents a vertex.  ;  Still the same problem, would it help if I post a screenshot? ;  For a 100 x 96 height map you need to access elementsin the range of [0,99] x [0,95]You loop looks like it is it is overstepping the bounds by 1 in each dimension.  Try changing to the comparison in your for loops to < and > (respectively).change to: for(x = 0; x < map_breadth - 1; x++)for(y = map_width - 1; y >= 0; y -=1)for(y = 0; y < map_breadth; y++)Jeff 