4 Replies - 2324 Views - Last Post: 09 November 2006 - 03:20 AM Rate Topic: -----

#1 TyForHelping  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 08-November 06

[C++/OpenGL] Double drawing problem

Post icon  Posted 08 November 2006 - 02:05 PM

void RenderHeightMap()		
{
	int X, Y, Z;			
	string line;							

	glBegin( GL_POINTS );
	ifstream myfile ("map.txt");
	
	if(myfile.is_open()){
		   while(!myfile.eof()){
			   for(X = 0; X < MAP_SIZE; X += STEP_SIZE)
				   for(Z = 0; Z < MAP_SIZE; Z += STEP_SIZE)
				   {
						getline(myfile,line);
						Y = atoi(line.c_str());					
								
						glVertex3i(X, Y, Z);
			   }
		   myfile.close();
		   }
	}
		   
	glEnd();
}



Ive been confused about this a long time already. If you go look at the attackment you will see the problem, it draws the map like it should do, but it also draws a flat bottom, and i cant find out why it happens.

Attached image(s)

  • Attached Image


Is This A Good Question/Topic? 0
  • +

Replies To: [C++/OpenGL] Double drawing problem

#2 Videege  Icon User is offline

  • rÍvant.toujours
  • member icon

Reputation: 6
  • View blog
  • Posts: 1,413
  • Joined: 25-March 03

Re: [C++/OpenGL] Double drawing problem

Posted 08 November 2006 - 03:22 PM

Can you post the input file you're using?

Welcome to DIC!
Was This Post Helpful? 0
  • +
  • -

#3 TyForHelping  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 08-November 06

Re: [C++/OpenGL] Double drawing problem

Posted 08 November 2006 - 11:42 PM

This is a small piece of the map, for full version look at the attachment

128 
126 
125 
126 
128 
127 
123 
119 


Since im using the For function i only have to store the height.

Attached File(s)

  • Attached File  map.txt (24.17K)
    Number of downloads: 94

This post has been edited by TyForHelping: 08 November 2006 - 11:44 PM

Was This Post Helpful? 0
  • +
  • -

#4 Videege  Icon User is offline

  • rÍvant.toujours
  • member icon

Reputation: 6
  • View blog
  • Posts: 1,413
  • Joined: 25-March 03

Re: [C++/OpenGL] Double drawing problem

Posted 09 November 2006 - 01:05 AM

On a second glance at your code, I don't even think you need your while loop, remove it and see what happens.
Was This Post Helpful? 0
  • +
  • -

#5 TyForHelping  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 08-November 06

Re: [C++/OpenGL] Double drawing problem

Posted 09 November 2006 - 03:20 AM

It works, ty very much
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1