Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a textured plane in blender of size 2×2 and I am using that as a tile. This is the screenshot of what I have done in blender. Nothing special, the default plane on origin, I just added a texture.

enter image description here

I exported this plane to iPhone as POD file. And using below code, I created my tile map.

//getting the tile
CC3MeshNode * greenSlate  = (CC3MeshNode*)[self getNodeNamed:@"GreenSlate"];

CC3Vector greenSize       = [self returnSizeOfNode:greenSlate];

//This one printed as 2.0, 0.0, 2.0 .     
NSLog(@"greenSlate : %f  %f %f", greenSize.x, greenSize.y, greenSize.z);

float xOffset           =   -3;
float zOffset           =   -3;

for (int column = 0; column < 3; column++) {
    for (int row = 0; row < 3; row++) {
        CC3MeshNode * mesh  =   nil;

        float xStart        =   xOffset;
        float zStart        =   zOffset;

        mesh            =   [greenSlate copy];

        xStart          =   xOffset + column * greenSize.x;
        zStart          =   zOffset + row * greenSize.z;

        mesh.location   =   cc3v(xStart , 0  , zStart);
        mesh.visible    =   YES;

        //add to scene
        [self addChild:mesh];

And when I run on simulator, I am getting this.

enter image description here

The tiles are at correct position, but there is a black line between each tile. How can I remove these lines?

share|improve this question

Guess this is a rounding issue. Have you tried rounding your vertex coordinates?

share|improve this answer
I thought of that too.. The size of one tile is 2 x 2.. And the xStart and yStart in the above code takes values : -3.0, -1.0, 1.0 (I did an NSLog) which is round I think. – Krishnabhadra Jul 12 '13 at 8:27
Just to be sure, what happens when rendering white untextured quads? Since you're not reusing vertices, I'd try letting them overlap a tiny bit. This can be hardware and resolution dependent, but I'd try some small value. – Mario Jul 12 '13 at 8:36
Super @Mario, yes.. When I run untextured quads, there is no lines in between.. Oops and I need it to be textured. – Krishnabhadra Jul 12 '13 at 8:48
Then there's something happening with your texture, try playing around with texture quality/filtering options as well as texture wrapping. – Mario Jul 12 '13 at 9:01
up vote 0 down vote accepted

Okay I solved it. The issue was pretty basic, and I guess basics is what I haven't learn about openGL.

I was using a texture of dimension 200 x 200, but openGL requires textures to be the power of 2 to avoid rounding artifacts. So I changed my texture to 256 x 256, and voila the black lines went away.

One other thing causing this weird lines is explained here.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.