# G4P multiple windows and noSmooth()

**URL:** <https://discourse.processing.org/t/g4p-multiple-windows-and-nosmooth/45690>\
**Category:** Libraries\
**Created:** [February 1, 2025, 2:35pm UTC](https://discourse.processing.org/t/g4p-multiple-windows-and-nosmooth/45690 "2025-02-01T14:35:29Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![joejoe](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@joejoe](https://discourse.processing.org/u/joejoe)\
**Post date:** [February 1, 2025, 2:35pm UTC](https://discourse.processing.org/t/g4p-multiple-windows-and-nosmooth/45690/1 "2025-02-01T14:35:29Z")

</div>

I’m trying to display different images in different G4P windows without smoothing the image as I need sharp edges. I have set the noSmooth() in the setup() just after the size() instruction for the main window. This works fine for images displayed in the main window but images displayed in additional windows still get smoothed.

I’m using processing 4

thanks in advance for helpful comments .

---

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [February 1, 2025, 3:13pm UTC](https://discourse.processing.org/t/g4p-multiple-windows-and-nosmooth/45690/2 "2025-02-01T15:13:17Z")

</div>

Welcome to the forum.

If you create a window with something like

```auto
myWindow = GWindow.getWindow(this, ...);

```

Then you might try adding this statment after the window is created

```auto
myWindow.noSmooth();

```

I have not tested this but it should work. 😄

---

<div class="post-metadata">

**Author:** ![joejoe](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@joejoe](https://discourse.processing.org/u/joejoe)\
**Post date:** [February 1, 2025, 3:26pm UTC](https://discourse.processing.org/t/g4p-multiple-windows-and-nosmooth/45690/3 "2025-02-01T15:26:41Z")

</div>

I will give it a go, I resorted to asking chatGPT and the first answer I had already tried myself , its second answer was to us PGraphics to force a noSmooth… still trying to get my head around its answer to try it out. I’ll try your suggestion also , thank you for the fast response.

---

<div class="post-metadata">

**Author:** ![joejoe](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@joejoe](https://discourse.processing.org/u/joejoe)\
**Post date:** [February 1, 2025, 3:29pm UTC](https://discourse.processing.org/t/g4p-multiple-windows-and-nosmooth/45690/4 "2025-02-01T15:29:50Z")

</div>

The ‘myWindow.noSmoth()’ suggestion didn’t work, it was a quick test and had it worked… but unfortunately no.

---

<div class="post-metadata">

**Author:** ![joejoe](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@joejoe](https://discourse.processing.org/u/joejoe)\
**Post date:** [February 1, 2025, 3:46pm UTC](https://discourse.processing.org/t/g4p-multiple-windows-and-nosmooth/45690/5 "2025-02-01T15:46:50Z")

</div>

Ok chatGTP suggestion worked a treat. load image into a PGraphics buffer with noSmoothing applied then load into the G4P window.

---

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [February 1, 2025, 3:57pm UTC](https://discourse.processing.org/t/g4p-multiple-windows-and-nosmooth/45690/6 "2025-02-01T15:57:24Z")

</div>

I am glad you have found a solution but it is not ideal because it is a lot of work if you had many images, and what about smoothing fonts being displayed with the `text(...)` method. Personally I think it would be nice if G4P windows had a `noSmooth` option.

I have just looked at the reference for [noSmooth](https://processing.org/reference/noSmooth_.html) and it says it can only be run once for each sketch and it should appear after the call to `size(...)`

In G4P secondary windows are seperate ‘sketches’ but the user has no opportunity to set the `noSmooth()` option before the draw loop starts.

I will have a look at the source code and see if G4P can be modified to solve this problem.

---

<div class="post-metadata">

**Author:** ![joejoe](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@joejoe](https://discourse.processing.org/u/joejoe)\
**Post date:** [February 1, 2025, 6:37pm UTC](https://discourse.processing.org/t/g4p-multiple-windows-and-nosmooth/45690/7 "2025-02-01T18:37:36Z")

</div>

Great, thankyou for that.

---

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [February 2, 2025, 10:54am UTC](https://discourse.processing.org/t/g4p-multiple-windows-and-nosmooth/45690/8 "2025-02-02T10:54:32Z")

</div>

Unfortunately it is not possible to enable G4P windows to use `noSmooth`.

As the reference says it must be executed after the call to `size(...)` which is deep inside the Processing library and is executed before G4P has a chance to use `noSmooth()`.

Sorry about that but fortunately you do have a solution, even if it is not ideal.

---

<div class="post-metadata">

**Author:** ![joejoe](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@joejoe](https://discourse.processing.org/u/joejoe)\
**Post date:** [February 2, 2025, 5:38pm UTC](https://discourse.processing.org/t/g4p-multiple-windows-and-nosmooth/45690/9 "2025-02-02T17:38:17Z")

</div>

Cheers for taking the time to check.  
The solution I have is a little more long winded but so far it seems to be working for my scenario.
