Jump to content
  • Advertisement

Archived

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

MonkeyInBlack

Weird lines

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

I've been trying to get a map-loader to work but no matter what i try i'm getting these strange lines (which appear/disappear as the screen moves) : I have absolutely no clue what i'm doing wrong. Im using a matrix of textured quads. If there is anyone who can hint me to where i should look for a solution i'd greatly appreciate it Source code using Nehe's simple base code : here code for the drawglscene() :
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadIdentity();
	glPushMatrix();
		glTranslatef(-1.5f+transx,0.0f+transy,-6.0f); // Screen movement

		glColor4f(1.0f,1.0f,1.0f, 1.0f);		
		glEnable(GL_TEXTURE_2D);
		for (int j=0; j<MAP_HEIGHT; j++)
			for (int i=0; i<MAP_WIDTH; i++)
			{
			glPushMatrix();
			glTranslatef((i*8.0f),-(j*8.0f),0.0f);
			glPushMatrix();
			int text;
			switch (GetTile(i,j)) {
			case 1: text = 29; break;
			case 4: text = 29; glRotatef(90.0f,0.0f,0.0f,1.0f);	break;
			case 3:	text = 29; glRotatef(180 ,0.0f,0.0f,1.0f); break;
			case 2:	text = 29; glRotatef(270 ,0.0f,0.0f,1.0f); break;
			case 7:	text = 30; break;
			case 6:	text = 30; glRotatef(90 ,0.0f,0.0f,1.0f); break;
			case 5:	text = 30; glRotatef(180 ,0.0f,0.0f,1.0f); break;
			case 8:	text = 30; glRotatef(270 ,0.0f,0.0f,1.0f); break;
			case 9: text = 31; break;
			case 10:text = 31; glRotatef(90.0f,0.0f,0.0f,1.0f);	break;
			case 11:text = 32; break;
			default: text = 27;
			}
			glBindTexture(GL_TEXTURE_2D, tiletexture[text].texID);
			glBegin(GL_QUADS);											
				glTexCoord2f(0.0f,0.0f); glVertex2f( -4.0f,-4.0f);
				glTexCoord2f(1.0f,0.0f); glVertex2f(  4.0f,-4.0f);
				glTexCoord2f(1.0f,1.0f); glVertex2f(  4.0f, 4.0f);
				glTexCoord2f(0.0f,1.0f); glVertex2f( -4.0f, 4.0f);
			glEnd();
			glPopMatrix();
			glPopMatrix();
			}
		glDisable(GL_TEXTURE_2D);
	glPopMatrix();
The Monkey is back ! [edited by - MonkeyInBlack on March 7, 2004 1:37:55 PM]

Share this post


Link to post
Share on other sites
Advertisement
Could your texture coordinates be wrapping? This will happen if you render you map at fractional coordinates.

Share this post


Link to post
Share on other sites
I changed my opening post : it now includes the source to drawglscene and the complete source code w images

I''m rendering to a black background. Dont think the texturing coordinates are wrong. The weird thing is that the lines arent always there - they appear/become larger when the screen is moved. Also as you can see the lines arent there every time - which seems weird too.



The Monkey is back !

Share this post


Link to post
Share on other sites
quote:
Original post by MonkeyInBlack
I changed my opening post : it now includes the source to drawglscene and the complete source code w images

I'm rendering to a black background. Dont think the texturing coordinates are wrong. The weird thing is that the lines arent always there - they appear/become larger when the screen is moved. Also as you can see the lines arent there every time - which seems weird too.



The Monkey is back !


Still looks like your texture coordinates are wrapping. Try clamping them..


glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );

(For each texture)

[edited by - willm on March 7, 2004 1:20:56 PM]

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!