Archived

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

Height map based terrain

This topic is 6113 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

Ok, Ive got a problem with loading a tga heightmap (greyscale) and displaying it on the screen. When I do, it has a triangle going from the far left to the beginning of the next row.. for every row. As you can see in these screen shots which might i add are a pain in the ass to get on this forum . in the second screenshot you can see the terrain thru lines so it is being rendered. sorry about the size... they used to be 5mb each tho... the code that puts this in the display list:
  
	glNewList(land,GL_COMPILE);
	for(int y=0;y<tga->height-1;y++)
	{
		glBegin(GL_TRIANGLE_STRIP);
		for(int x=0;x<tga->width;x++)
		{		
				glColor3f(tga->imageData[x+((y+1)*tga->width)],tga->imageData[x+((y+1)*tga->width)],tga->imageData[x+((y+1)*tga->width)]);
				glVertex3f(x,y+1,heights[x+((y+1)*tga->width)]);//255.0f);

				glColor3f(tga->imageData[x+((y)*tga->width)],tga->imageData[x+((y)*tga->width)],tga->imageData[x+((y)*tga->width)]);
				glVertex3f(x,y,heights[x+(y*tga->width)]);//255.0f);

		}
		
		glEnd();
	}
	glEndList();
  
I am using code from http://www.fatech.com/tech/opengl/terrain/index.php3?tgalib so i know this should work but it isnt. Thanks allot!

Share this post


Link to post
Share on other sites
? They show up normally for me... try right clicking where they should be and show picture... ... it seems that every row the z drops back down to zero after a peak... ... ya somthing like that

if you want me to email u the images/program/src just leave your email/icq # Thanks again

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I''m working on something similar, check out my program and see if it is what you are looking for.

http://www.savvynet.com/~joel/

My program loads .RAW files instead of TGA files, so download both the TrackEd.exe and automap.map.

Use the arrows keys and pg-up pg-dn to rotate.

s d f e and keypad + and - move the terrain

home - end modifies the height scale.

click and drag to select, then + and _ (next to backspace) to move that area up and down.

I need some help with the selection, right now I can''t figure out how to directly select the points...

Share this post


Link to post
Share on other sites