Transforming 2D Tiles

I’m having a problem and I don’t know where to start on it. I’m hoping someone on this forum has dealt with something similar.

I’m laying out a bunch of tiles as flat textured planes. The size of the planes is the same as the pixels of the original source graphics, which is 24x24 per tile. Everything looks fine.

Next, I try to do some fancy effects such as rotating the entire scene, or translating on the z axis to create a zooming effect. As soon as I do this, thin black lines appear between all the tiles. They seem to no longer have their edges perfectly lined up with each other.

Does anyone have ideas on how to approach this problem? I’m not sure if I need to look at how I set up my projection matrix, dig up some kind of hints to be setting, or what. Thoughts?

-Paul

Ok, going to answer my own question. :slight_smile:

Trying all kinds of different projections and hints, I eventually came across this bit of code that I’ve been using for sprites with transparency:

gl.enable(GL.ALPHA_TEST);
gl.alphaFunc(GL.GREATER, 0.1f);

It would seem my value of 0.1 was a bit too strict. I upped it to 0.5, and lo and behold all those black lines went away. I guess the edges of those graphics had a very slight alpha value.

Well, thanks for listening anyway.

-Paul

Thanks for posting your own solution, I wish more people would do this.

I render all my tiles using the same indexed vertex coordinates which guarantees they’re stitched together as well.

Cas :slight_smile:

Yes, I had thought of stitching the tiles together. Unfortunately at this point that would be a pretty big gutting of my code, which was origianally written on top of Java2D. I’m glad I was able to work around it this way instead.

Paul