Archived

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

BeyondDeath

Height map based terrain

Recommended Posts

BeyondDeath    122
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
BeyondDeath    122
? 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
zedzeek    528
rename your *.jpg files to *.bollux files , xoom doesnt allow direct acces to jpg files

http://members.xoom.com/myBollux

Share this post


Link to post
Share on other sites
BeyondDeath    122
I see what u mean now... on my laptop.. musta had the pics in the cache on my other computer... ill put it on my server after school

*curses at the crappy free hosting sites*

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
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
BeyondDeath    122
I found a lib that does what I need properly.. the one from the site i mentioned. So im just gonna use that and work on making some p-noise generated terrain.

Share this post


Link to post
Share on other sites