# OpenGL disable anti-aliasing

**URL:** <https://discourse.processing.org/t/opengl-disable-anti-aliasing/2024>\
**Category:** Coding Questions\
**Created:** [July 23, 2018, 7:47pm UTC](https://discourse.processing.org/t/opengl-disable-anti-aliasing/2024 "2018-07-23T19:47:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![DongKingKong0](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/dongkingkong0/32/960_2.png) [@DongKingKong0](https://discourse.processing.org/u/DongKingKong0)\
**Post date:** [July 23, 2018, 7:47pm UTC](https://discourse.processing.org/t/opengl-disable-anti-aliasing/2024/1 "2018-07-23T19:47:38Z")

</div>

The question is simple:  
Is there any way to disable anti-aliasing in OPENGL?  
I couldn’t find a way to do this, so any suggestion is much appreciated 🙂

---

<div class="post-metadata">

**Author:** ![alexr4](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/alexr4/32/576_2.png) [@alexr4](https://discourse.processing.org/u/alexr4)\
**Post date:** [July 23, 2018, 8:36pm UTC](https://discourse.processing.org/t/opengl-disable-anti-aliasing/2024/2 "2018-07-23T20:36:09Z")

</div>

You can use `noSmooth()` function on the `setup()`.  
Here is the reference : [https://processing.org/reference/noSmooth\_.html](https://processing.org/reference/noSmooth_.html)

---

<div class="post-metadata">

**Author:** ![DongKingKong0](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/dongkingkong0/32/960_2.png) [@DongKingKong0](https://discourse.processing.org/u/DongKingKong0)\
**Post date:** [July 24, 2018, 7:12am UTC](https://discourse.processing.org/t/opengl-disable-anti-aliasing/2024/3 "2018-07-24T07:12:00Z")

</div>

`noSmooth()` doesn’t seem to work with OpenGL or P3D.  
I want to use textures and `noSmooth()` doesn’t affect images.

---

<div class="post-metadata">

**Author:** ![alexr4](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/alexr4/32/576_2.png) [@alexr4](https://discourse.processing.org/u/alexr4)\
**Post date:** [July 24, 2018, 7:26am UTC](https://discourse.processing.org/t/opengl-disable-anti-aliasing/2024/4 "2018-07-24T07:26:57Z")

</div>

it’s because aliasing only affect drawing not texture. If you want tu change the aliasing of a image/texture you need to change te texture sampling. You can also desactivate the mipmaps using the `hint(DISABLE_TEXTURE_MIPMAPS)`.

By default, processing use the highest filtering mode GL\_LINEAR\_MIPMAP\_LINEAR for minimfication, GL\_LINEAR for magnification and anisotropic filtering. You can change the texture filtering method by using the function textureSampling(int f) where f can be 2 (NEAREST), 3, (LINEAR), 4 (BILINEAR) and 5 (TRILINEAR)

In your case I believe you can use the nearest neighbors filtering mode in order to have an non-aliased texture :

```auto
hint(DISABLE_TEXTURE_MIPMAPS);
((PGraphicsOpenGL)g).textureSampling(2);

```

You can leanr more about texture filtering in processing on the wiki page dedicated to advanced OpenGL : [https://github.com/processing/processing/wiki/Advanced-OpenGL](https://github.com/processing/processing/wiki/Advanced-OpenGL) also here is a great information about texture filtering in OpenGL [https://learnopengl.com/Getting-started/Textures](https://learnopengl.com/Getting-started/Textures) and [http://what-when-how.com/opengl-programming-guide/filtering-texture-mapping-opengl-programming/](http://what-when-how.com/opengl-programming-guide/filtering-texture-mapping-opengl-programming/)

---

<div class="post-metadata">

**Author:** ![DongKingKong0](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/dongkingkong0/32/960_2.png) [@DongKingKong0](https://discourse.processing.org/u/DongKingKong0)\
**Post date:** [July 24, 2018, 7:29am UTC](https://discourse.processing.org/t/opengl-disable-anti-aliasing/2024/5 "2018-07-24T07:29:58Z")

</div>

That’s what I wanted, thanks 😊
