G4P multiple windows and noSmooth()

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 .

Welcome to the forum.

If you create a window with something like

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

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

myWindow.noSmooth();

I have not tested this but it should work. :smile:

1 Like

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.

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

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

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 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.

1 Like

Great, thankyou for that.

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.

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.