scaling causes artifacts

Hello guys,

i’m working on an opengl based tile game. the game map is formed by many tiles.
The game looks fine, but somebody thought the tiles are too small.

i therefore want to enlarge the game map simply by applying a scaling matrix before drawing these tiles.

but then i started to see cracks between tiles.

this is how i draw the tiles:

glMatrixMode(GL_MODELVIEW);
                        glPushMatrix();
                        glScalef(scale,scale,1.0);
                  map.draw();
                        glPopMatrix();

this is how it looks like without scaling (scale==1.0)

this is when scale=1.5

as you can see between the tiles, there are cracks. cracks don’t always happen, it happens when the tile’s coordinates has odd number.

for example, if the tile’s coordinates are (3,3), you will see the problem, but if the coordinates are (4,6) you won’t see the cracks.

i first thought this problem may be a driver issue. but i have tried on both ubuntu and mac os, same problem.

what’s wrong?

Thanks.

I would suggest that you not scale everything, it might be the easy way out but it would be better to create your tiles with the proper coordinates verses scaling. The reason I suggest this is because every command you call takes time to process, so if you can eliminate it then you should try to do that.

This can probably be solved by changing the options you use when uploading your texture. If you’re using GL_CLAMP, try GL_CLAMP_TO_EDGE or disabling linear filtering.