I want to draw some terrain tiled terrain but it appears there are outlines or gaps around the textures because there is a visible grid between each tile. Even if I make each tile bigger so that they overlap these annoying outlines are still visible.
The texture is loaded like this:
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Tex_Terrain = SOIL_load_OGL_texture("Data/Mud_Terrain.png",SOIL_LOAD_AUTO,SOIL_CREATE_NEW_ID,SOIL_FLAG_MIPMAPS | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT);
The drawn function is like this:
void Draw_Texture(float x, float y, float width, float height, float Angle, GLuint texture)
{
glPushMatrix();
glBindTexture(GL_TEXTURE_2D,texture);
glTranslatef(x, y, 0);
glRotatef(Angle, 0, 0, 1);
glBegin(GL_QUADS);
glTexCoord2d(0.0,0.0); glVertex2d(-width/2, -height/2);
glTexCoord2d(1.0,0.0); glVertex2d(width/2, -height/2);
glTexCoord2d(1.0,1.0); glVertex2d(width/2, height/2);
glTexCoord2d(0.0,1.0); glVertex2d(-width/2, height/2);
glEnd();
glPopMatrix();
}
And it is tiled like this:
void Draw_Terrain(void)
{
for (int i = 0; i < MAP_WIDTH; i += 64)
{
for (int j = 0; j < MAP_HEIGHT; j += 64)
{
Draw_Texture(i+32, j+32, 64, 64, 0, Tex_Terrain);
}
}
}
Any glaring problems? Also, how can you tile infinitely?
Any help is much appreciated.
Thanks,
Rowan