Ugly strokes between tiles :(

Started by
2 comments, last by suckxez 18 years, 8 months ago
Hi! I'm currently trying to make something like a ISO Map in OpenGL and create a map with following code:

for(float ax=0; ax < MAP_WIDTH; ax++)
{
	for(float ay=0; ay < MAP_HEIGHT; ay++)
	{
		x+= 1;
		y+= 0.5f;
		glBindTexture(GL_TEXTURE_2D, m_Texture.TextureID);
		glBegin(GL_TRIANGLE_STRIP );
			glTexCoord2f(0.0f, 0.0f); glVertex3f(float(x), float(y), 0.0f);
			glTexCoord2f(1.0f, 0.0f); glVertex3f(float(x + 1), float(y - 0.5f), 0.0f);
			glTexCoord2f(0.0f, 1.0f); glVertex3f(float(x + 1), float(y + 0.5f), 0.0f);
			glTexCoord2f(1.0f, 1.0f); glVertex3f(float(x + 2), float(y), 0.0f);
	glEnd();	
		
		if(ay == MAP_HEIGHT-1)
		{
			y=old_y+0.5;
			x=old_x-1;
			old_x = x;
			old_y = y;
		}
	}



Now.. when I'm using a trilinear filter i get ugly strokes: If the Bi/Trilinear filter is turned off, there are not any bothering strokes. But why? Another thing: Do you have any ideas how to create a iso map in a better way? I think my for-loop is a little bit "unesthetic" and bad ;P
Advertisement
Use GL_CLAMP_TO_EDGE to remove the seams. Example:
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );

Read up about it here: Texture Borders and Tiling
Also here: GL_CLAMP_TO_EDGE problem
If you are interested, my library handles 2D Graphics quite well under OpenGL. Feel free to use it, or just peek around at the source.

It's called hxRender, see sig for details.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One
Thank you, that works fine for me!

This topic is closed to new replies.

Advertisement