Jump to content
  • Advertisement

Archived

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

stryx

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
I think you must use TRIANGLE_STRIPS..
this will be faster..

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

good luck();

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!