# OpenGL: Filtering/antialising textures in a 2D game

I'm working on a 2D game using OpenGL 1.5 that uses rather large textures. I'm seeing aliasing effects and am wondering how to tackle those.

I'm finding lots of material about antialiasing in 3D games, but I don't see how most of that applies to 2D games - e.g. antisoptric filtering seems to make no sense, FSAA doesn't sound like the best bet either.

I suppose this means texture filtering is my best option?

Right now I'm using bilinear filtering, I think:

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);


From what I've read, I'd have to use mipmaps to use trilinear filtering, which would drive memory usage up, so I'd rather not.

I know the final sizes of all the textures when they are loaded, so can't I somehow size them correctly at that point? (Using some form of texture filtering).

• You really should add mipmaps for your textures, at least some of them, it will improve visual quality. Other than that, aliasing is usually on the polygon level, so you could use some image-space antialiasing technique to optimize the textures quality. – Grimshaw May 7 '13 at 14:33
• Note that mipmaps increase the memory usage only by 33%. – msell May 7 '13 at 15:22
• Picture please. Also, how are you using the textures? Will any of them be used at loss of detail zoom out level? – aaaaaaaaaaaa May 7 '13 at 16:10
• @DevilWithin 33% more is quite a bit in my case. On a MacBook Pro Retina, I'm already at 1 GB of resident memory use for the huge artwork. Also, speculatively generating smaller images seems wasteful, I know exactly how big my texture is going to be on screen at load time. – futlib May 8 '13 at 9:05
• futlib, artwork is not supposed to be at the local RAM memory! Unless you need to manipulate exceptional cases at runtime, you shouldn't have any images in the RAM. You load them, you upload to the GPU as a texture and unload the pixel data. Even if you only have 256MB or RAM and 256MB of video ram, I am sure you can fit everything into it. Most AAA games deal with that in huge worlds, I am sure you could too ;) – Grimshaw May 8 '13 at 12:35

Resample the image as soon as you know the target size.

You can use the GPU to resample with hardware acceleration: