#### Archived

This topic is now archived and is closed to further replies.

# Problems with simple Heightmap

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

## Recommended Posts

Hi, I''m encountering strange problems with heightmapping. I read in a file (reading is correct) and then draw it with this code: glBegin (GL_QUADS); for (int mapy=0; mapy<(HEIGHTMAP_WIDTH-1); mapy++) { for (int mapx=0; mapx<(HEIGHTMAP_HEIGHT-1); mapx++) { glTexCoord2f (0.0f, 0.0f); glVertex3i ((mapx) ,Heightmap[mapx+(mapy*HEIGHTMAP_WIDTH)] ,mapy); glTexCoord2f (1.0f, 0.0f); glVertex3i ((mapx)+1,Heightmap[mapx+1+(mapy*HEIGHTMAP_WIDTH)] ,mapy); glTexCoord2f (1.0f, 1.0f); glVertex3i ((mapx)+1,Heightmap[mapx+1+((mapy+1)*HEIGHTMAP_WIDTH)],(mapy)+1); glTexCoord2f (0.0f, 1.0f); glVertex3i ((mapx) ,Heightmap[mapx+((mapy+1)*HEIGHTMAP_WIDTH)] ,(mapy)+1); } } glEnd(); The problem is, that i don''t get quads or my terrain, i get pyramids. To explain look at this screenshot. The height map was a simple quad (the pyramid-wood at the left and some stuff down there (pyramid-holes). I can''t figure out what''s the problem. Please help since I must have this Engine ready for 1st september. Thanks, StryX

##### Share on other sites
I think you must use TRIANGLE_STRIPS..
this will be faster..

you need an array of vertices...
and draw this with glDrawElements();

good luck();

1. 1
2. 2
3. 3
Rutin
22
4. 4
JoeJ
17
5. 5

• 14
• 30
• 13
• 11
• 11
• ### Forum Statistics

• Total Topics
631774
• Total Posts
3002297
×