0

I'm developing a game where the players can drag and drop CCSprites around an Isometric map which is created using the Tiled Map Editor.

To allow automatic vertexZ reordering I have enabled the depthTest option of [CCDirector sharedDirector] in my AppDelegate.

Whenever the CCSprites positions are updated i call this function

- (void)updateVertexZ:(CGPoint)tilePos tileMap:(CCTMXTiledMap *)tileMap
{
    float lowestZ = -(tileMap.mapSize.width + tileMap.mapSize.height);
    float currentZ = tilePos.x + tilePos.y;
    self.vertexZ = lowestZ + currentZ;
}

which correctly reorders the sprites.

Whenever such a sprite is instantiated, I set the shaderProgram like this:

self.shaderProgram = [[CCShaderCache sharedShaderCache]programForKey:kCCShader_PositionTextureColorAlphaTest];

Now, when two sprites are aligned like this (x being a sprite, 0 being empty):

0 x 
x 0

and are observed from an Isometric perspective. They are indeed placed correctly. However along the first(closest) sprite a 1px-border is visible - see image. It is the floor in the background - not very cool.

enter image description here

Why is this border visible and how can I get rid of it?

genpfault
  • 51,148
  • 11
  • 85
  • 139
Eyeball
  • 3,267
  • 2
  • 26
  • 50

0 Answers0