Greg Dolley’s Weblog

A Blog about Graphics Programming, Game Programming, Tips and Tricks

How to Turn Off Bilinear Filtering in OpenGL

Posted by gregd1024 on January 14, 2008

I don’t know which video game popularized bilinear filtering (or trilinear filtering for that matter) for close-up objects but I personally hate the effect. The only time I can accept the look of filtering textures in this manner is if the texture’s resolution is massively high (so I don’t see the blur). Note: for this post when I say “bilinear filtering” I’m also referring to “trilinear filtering” – both have the same blurring effects.

Let me show you what I mean and then I’ll explain how to turn it off. The effects of bilinear filtering are best seen on textures that contain straight lines. Therefore, I put a simple checkerboard-like texture on a wall and moved the camera close to it:


Notice how the edges of the alternating dark-green / light-green squares are clear and crisp. Now, let’s look at the exact same thing but with bilinear filtering turned on:


The edges are not clear and crisp anymore. The whole texture looks a bit blurry. If we move closer to the wall, it gets even worse:


The screenshot above looks much worse in its original size; click on the picture to enlarge. Now if we didn’t use bilinear filtering it would look like this:


Hence the reason why I don’t like bilinear filtering. It just makes things too blurry. However, I have yet to see any game programming tutorial or OpenGL tutorial explain how to turn it off.

Actually it’s very simple to turn off. After loading a texture you need to make the following two function calls:



Most code examples already have these calls except the values for parameter three are different. The value for that parameter depends on parameter two. Here are possible combinations:

  1. When the second parameter is GL_TEXTURE_MIN_FILTER, parameter three can be:
    6. GL_LINEAR
  2. When the second parameter is GL_TEXTURE_MAG_FILTER, parameter three can be:
    1. GL_LINEAR

I don’t want to stray off topic and explain each parameter combination, but don’t worry, I’ll write another post on that topic soon. For now, just know that most examples use GL_LINEAR_MIPMAP_NEAREST for min filter and GL_LINEAR for mag filter. This combination sets up typical bilinear filtering used in most games. Trilinear filtering is almost the same except GL_LINEAR_MIPMAP_LINEAR is used instead of GL_LINEAR_MIPMAP_NEAREST.

When you set both parameters to GL_NEAREST it tells OpenGL to not interpolate any of the texel color values. It takes the calculated (u, v) coordinates, finds the texel nearest to that point in the source bitmap, and uses that color. So essentially it is just like old software rendering engines before everybody started using bilinear filtering.

-Greg Dolley

*Get new posts automatically! Subscribe via RSS here . Want email updates instead? Click here.


14 Responses to “How to Turn Off Bilinear Filtering in OpenGL”

  1. Kvast said

    Thank you so much for this simple but valuable info. It was exactly what I searched for 🙂

  2. gregd1024 said


    Thank you for the kind words! 🙂 I figured there’s got to be someone else out there who was trying to do the same thing.


  3. UZiX said


    i am definitely one of those who want to turn off that bluring effect. thanx for this simple but very valuable entry.
    u save my day! thanx again.

  4. gregd1024 said

    Ah, so Kvast and I are not alone! 😉 Thx Uzix!


  5. ac said

    There doesn’t appear to be option in Nhancer (nvidia card setting customizer) for doing this.

    The idea I’m getting is that for playing old games you could intercept these calls, turn off the filtering, then if you wanted you could for each texture (that now looks blocky low res) apply a better filter invidually such as hq2x.fx in pixel shader. (this makes old 320×200 games look like they were made today, rather amazing effect)

    Could be it wouldn’t work, too expensive? Just a thought, making some of those old 3d games look better in a generic way seems interesting.

  6. gregd1024 said

    Hi Ac,

    Well, maybe I’m missing something, but how would you intercept the calls?


    • justjohnny said

      Wrapping? Hooking?

      I’m not sure completely, but I know that there are some pretty clever cats over at the Windows 2000 Gaming(Playing XP games on Windows 2000) forum that would know how to do it.

  7. Danial said

    Nhancer DOES provide Mipmapping settings, they are on the compatibility tab,

  8. […] Here’s some discussion why you should not always use bilinear interpolation: […]

  9. Mike said

    Thanks, been looking for this for a while and found it here. Finally removed the annoying blur

  10.   said

    How would I go about disabling it entirely?

    I like the PSX look for games. Old games where the textures are low res have a lot of charm in software mode and appear more detailed. A Vagrant Story look I wish carried on.

    There must be some way of forcing the graphics card from doing it. A win-win tweak that would increase detail and performance. I’d donate to a software developer that provided an app to force essential unused tweaks like texture compression, backface cull, only rendering the current FOV etc.

    It’s strange and ugly the way graphics have gone. Thousands of triangles for a simple spherical shape that could be done with a volumetric equasion instead. Could use a extrude height map for both sides to make an object as detailed as the map’s resolution. Maybe the people that make it all work already know this but aren’t able to implement it.

  11. bdude said


    I’ve tried this but my game still ends up being blurry, it runs perfect and all, just can’t get rid of blurry-ness. It’s 320×240, and needs to be pixel-perfect. I understand games with resolutions smaller than 640×480 blurs on new graphics cards. Is there anyway I can avoid it? Or should just using GL_NEAREST fix it? In my case it doesn’t seem to help, only for games larger than 640×480.

    • gregd1024 said

      bdude – I’ve noticed that on some graphics cards you can’t turn off bilinear filtering on small resolutions (below 640×480). I’m thinking it’s a driver bug, and not the cards themselves. Have you tried writing your own pixel shader just for the texture mapping?

      -Greg Dolley

  12. ATI said

    ATI doesn’t support this correctly. It keeps the filtering on even if it’s forced on on the control panel (Anisotrophic filtering). That is a nuicance. On Nvidia it works correctly.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: