# Comfortable Antialiasing change?

**URL:** <https://forum.castle-engine.io/t/comfortable-antialiasing-change/2002>\
**Category:** 3D\
**Created:** [August 26, 2025, 1:07pm UTC](https://forum.castle-engine.io/t/comfortable-antialiasing-change/2002 "2025-08-26T13:07:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![phomm](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/phomm/32/2827_2.png) [@phomm](https://forum.castle-engine.io/u/phomm)\
**Post date:** [August 26, 2025, 1:07pm UTC](https://forum.castle-engine.io/t/comfortable-antialiasing-change/2002/1 "2025-08-26T13:07:25Z")

</div>

Following this topic [How good is CGE? Blender Cycles vs CGE - #5 by michalis](https://forum.castle-engine.io/t/how-good-is-cge-blender-cycles-vs-cge/1824/5) and help-pages, I have implemented the AA change during the game

  
and it works, but not at the same moment you change it, it needs either restart or Fullscreen to be (de)activated. As I understood the change of window mode is done deeply on OGL level, and it is not simple , ofc.  
The question is, can we use some workaround? for example by triggering some method of Window (similar to FS change, but somewhat nicer), and in my gameUI I would bind it to some Apply button.

Thanks !

---

<div class="post-metadata">

**Author:** ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)\
**Post date:** [August 26, 2025, 4:50pm UTC](https://forum.castle-engine.io/t/comfortable-antialiasing-change/2002/2 "2025-08-26T16:50:39Z")

</div>

1. Note that if you’re fine with “always having window with multi-sampling” and just want to toggle anti-aliasing on/off at run-time, you can use code like this:

2. For a proper answer to your question, how to make the changes to `Window.AntiAliasing` be applied:

---

<div class="post-metadata">

**Author:** ![phomm](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/phomm/32/2827_2.png) [@phomm](https://forum.castle-engine.io/u/phomm)\
**Post date:** [August 27, 2025, 1:26pm UTC](https://forum.castle-engine.io/t/comfortable-antialiasing-change/2002/3 "2025-08-27T13:26:48Z")

</div>

here I implemented 2 option, looks OK, but ofc with reopen.  
high-level approach with Window.Antialiasing looks more user-friendly, as it offers fine-tuning and exact text value.  
But I also tried 1 option, it works without reopen, but as I understood, I need Antialiasing/Multisampling be set to some value upfront (at app start), and then I’m able to turn on and off GL\_MULTISAMPLE without window reopen, so I need to set separately AA/MS value and glEnable and make use of it on the interface 😅  
and the fun fact, if you have saved AA value as none (or MS as 1) and set it up on start, then glEnable has no power on actual result 😅  
so I need to elaborate some sort of combination of these and put it to interface, presumably I will store it as direct AAvalue, I would use AA always at least minimal (but not None) to setup the window at start, and if AA is None I would make gldisable, otherwise enable. The only downside is that user is not able to change dynamically the quality of AA, only on/off, but maybe I would also keep an option to reopen window 🙂  
Let’s see

---

<div class="post-metadata">

**Author:** ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)\
**Post date:** [August 27, 2025, 3:58pm UTC](https://forum.castle-engine.io/t/comfortable-antialiasing-change/2002/4 "2025-08-27T15:58:14Z")

</div>

> [@phomm](#):
>
> But I also tried 1 option, it works without reopen, but as I understood, I need Antialiasing/Multisampling be set to some value upfront (at app start), and then I’m able to turn on and off GL\_MULTISAMPLE without window reopen, so I need to set separately AA/MS value and glEnable and make use of it on the interface 😅  
> and the fun fact, if you have saved AA value as none (or MS as 1) and set it up on start, then glEnable has no power on actual result 😅  
> so I need to elaborate some sort of combination of these and put it to interface, presumably I will store it as direct AAvalue, I would use AA always at least minimal (but not None) to setup the window at start, and if AA is None I would make gldisable, otherwise enable. The only downside is that user is not able to change dynamically the quality of AA, only on/off, but maybe I would also keep an option to reopen window 🙂

Indeed, to make use of the 1st option (toggling `glEnable(GL_MULTISAMPLE)` / `glDisable(GL_MULTISAMPLE)`) you need to have context initialized with multi-sampling. These options do nothing if context doesn’t have multi-sampling.

So this approach is simplest to use if you set some particular `Window.AntiAliasing` value (not none) always, like `aa4SamplesNicer`. And then at run-time you just present to user checkbox “Anti-Aliasing”, yes/no, and toggle `glEnable(GL_MULTISAMPLE)` / `glDisable(GL_MULTISAMPLE)` based on this choice.

This is admittedly less functional than the “full control of anti-aliasing” like in option 2, which allows to choose anti-aliasing quality.

I’d say that if you want the “full control of anti-aliasing”, then my “option 1” may be just unnecessary hassle 🙂 If you want to allow changing anti-aliasing quality, then you want to change `Window.AntiAliasing` and we need to recreate the context (which right now means: reopening the window).
