Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P3D & P2D window not showing on MacOS Ventura #544

Closed
chrisgrizzly opened this issue Aug 25, 2022 · 22 comments
Closed

P3D & P2D window not showing on MacOS Ventura #544

chrisgrizzly opened this issue Aug 25, 2022 · 22 comments
Labels
Help Wanted We have very little time and would like some help macOS Issue is specific to macOS

Comments

@chrisgrizzly
Copy link

Description

When using the P3D and P2D renderers, the window is not plotted on MacOS Ventura. With default size(), the window shows up correctly.

Expected Behavior

The window should show up when using P3D and P2D.

Current Behavior

The code will run, but no window rendered. From Mission Control on MacOS, a silhouette of the window could be seen, but the content is transparent. A thumbnail of the window is also shown at the top of Mission Control. See picture.
image

Steps to Reproduce

  1. Install MacOS Ventura beta
  2. Open example Topics>Textures>TextureCube
  3. Run

Your Environment

  • Processing version: 4.0.1 (August 9, 2022)
  • Operating System and OS version: macOS 13.0 Beta (22A5331f)
  • Other information:
@kdjanz
Copy link

kdjanz commented Aug 27, 2022

Confirmed with most recent beta Version 13.0 Beta (22A5331f).
Neither 4.0.1 for ARM or Intel will display the output window.

It appears the new version of Metal 3 in Ventura is not connecting with the old OpenGL calls.

@kdjanz
Copy link

kdjanz commented Aug 28, 2022

Just to confirm that everything works in Monterey as expected.

@brad-miller
Copy link

JDK 17 release notes
perhaps this might be of interest?

client-libs/2d
JEP 382: New macOS Rendering Pipeline
The Java 2D API used by the Swing APIs for rendering, can now use the new Apple Metal accelerated rendering API for macOS.

This is currently disabled by default, so rendering still uses OpenGL APIs, which are deprecated by Apple but still available and supported.

To enable Metal, an application should specify its use by setting the system property:

-Dsun.java2d.metal=true

Use of Metal or OpenGL is transparent to applications since this is a difference of internal implementation and has no effect on Java APIs. The metal pipeline requires macOS 10.14.x or later. Attempts to set it on earlier releases will be ignored.

For further details, see JEP 382.

@kdjanz
Copy link

kdjanz commented Sep 15, 2022

Confirmed to still be an issue with the most recent beta Version 13.0 Beta (22A5342f) (beta5)

I don't understand enough to attempt to implement, but perhaps that will help someone with deeper knowledge.

To enable Metal, an application should specify its use by setting the system property:
-Dsun.java2d.metal=true

I hope this can be fixed in the next release.

@kdjanz
Copy link

kdjanz commented Sep 15, 2022

I tried adding the line

-Dsun.java2d.metal=true
to the file at "/Applications/Processing\ ARM.app/Contents/PlugIns/jdk-17.0.4+8/Contents/Home/conf/conf/management/management.properties" then saving and restarting Processing, but it did nothing - which is not surprising since I have no clue as to what I am really doing!

@chrisgrizzly
Copy link
Author

Still an issues for the lated beta: Ventura 13.0 Beta (22A5352e). Hopefully this could be fixed before the official release of the OS, which is not far from now.

@chrisgrizzly
Copy link
Author

Possible workaround

Use fullScreen(P3D); instead of size(640, 360, P3D);. This will correctly render in fullscreen.

Screenshot 2022-09-21 at 11 07 47 PM

Any other ideas on how to exit fullscreen and set a window size? If so, the workaround would be better.

@benfry
Copy link
Owner

benfry commented Sep 23, 2022

Due to limited time, I'll have to wait until the Ventura release before taking a look at any of this, since I'm already supporting 3 versions of macOS across both Intel and Apple Silicon, and can't add an unreleased operating systems to the list.

With any luck, this may be fixed by Apple during the Ventura release process. It's definitely happened in the past (another reason I don't test with betas) though I'm not super optimistic.

Happy for any help on this one…

@benfry benfry added macOS Issue is specific to macOS Help Wanted We have very little time and would like some help labels Sep 23, 2022
@chrisgrizzly chrisgrizzly changed the title P3D & P2D window not showing on MacOS Ventura betas P3D & P2D window not showing on MacOS Ventura Oct 18, 2022
@chrisgrizzly
Copy link
Author

The issue is still there on macOS Ventura Release Candidate, which is equivalent to the final release.

@chrisgrizzly
Copy link
Author

The issue is persistent in MacOS Ventura officially released today.

@jaegonlee
Copy link

Another workaround(for m1 mac)

Add this code in PApplet.java(line 10146)

    if (present) {
      if (hideStop) {
        stopColor = 0;  // they'll get the hint
      }
      surface.placePresent(stopColor);
    } else {
      // start
      if (platform == MACOS) {
        try {
          final String td = "processing.core.ThinkDifferent";
          final Class<?> thinkDifferent = PApplet.class.getClassLoader().loadClass(td);
          thinkDifferent.getMethod("showMenuBar").invoke(null);
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
      // end
      surface.placeWindow(location, editorLocation);
    }

Tested on macOS 13.0 (22A380) / macbook pro m1

@jaegonlee
Copy link

jaegonlee commented Oct 27, 2022

I found a simple workaround

I switched the order of the functions(initDisplay(), initGL()) in PSurfaceJOGL.java
from

  public void initFrame(PApplet sketch) {
    this.sketch = sketch;

    initIcons();
    initDisplay(); // 
    initGL(); // 
    initWindow();
    initListeners();
    initAnimator();
  }

to

  public void initFrame(PApplet sketch) {
    this.sketch = sketch;

    initIcons();
    initGL(); //
    initDisplay(); //
    initWindow();
    initListeners();
    initAnimator();
  }

Screenshot 2022-10-27 at 4 17 00 PM

Or add this code to the top of processing code.

import com.jogamp.opengl.GLProfile;
{
  GLProfile.initSingleton();
}

void setup() {
  size(1024, 768, P3D);
...

Tested on macOS 13.0 (22A380) / macbook pro m1

@kdjanz
Copy link

kdjanz commented Oct 29, 2022

I downloaded source from GitHub and made the very simple changes in the last post from Jaegonlee. I rebuilt from scratch and the new binary works perfectly.

The only hiccup is that the new binary is Intel, so I end up having to run using Rosetta again on my M1 Mac Studio. That's fine until the official fix is made. Hopefully this can be fixed in the next release.

Thanks Jaegonlee!

@benfry benfry closed this as completed in 9e3522a Nov 4, 2022
@benfry
Copy link
Owner

benfry commented Nov 4, 2022

Awesome, many many thanks @jaegonlee… 

That change is now incorporated and will be part of 4.0.2 when it's released.

@retiutut
Copy link

retiutut commented Nov 8, 2022

Thanks @jaegonlee @benfry! We have sent out a message to our Mac users to post-pone updating for this reason. Happy to hear that a fix was taken care of swiftly!

@WhiteSte
Copy link

WhiteSte commented Nov 10, 2022

Awesome, many many thanks @jaegonlee… 

That change is now incorporated and will be part of 4.0.2 when it's released.

Thank you benfry! Do you know when it's gonna be released the new version? I can't use processing since 2 weeks

@WhiteSte
Copy link

WhiteSte commented Nov 16, 2022

Or add this code to the top of processing code.

import com.jogamp.opengl.GLProfile;
{
  GLProfile.initSingleton();
}

void setup() {
  size(1024, 768, P3D);
...

Tested on macOS 13.0 (22A380) / macbook pro m1

This worked for me. For who uses processing as java library put it inside the settings() function:

public void settings() {
		GLProfile.initSingleton();
		size(1400, 800, P3D);
}
	

@matt0rtega
Copy link

@WhiteSte How do you get com.jogamp.opengl.GLProfile into your project. I'm using IntelliJ and can't seem of figure out how to access it.

@WhiteSte
Copy link

WhiteSte commented Nov 20, 2022

@WhiteSte How do you get com.jogamp.opengl.GLProfile into your project. I'm using IntelliJ and can't seem of figure out how to access it.

I did not imported just the core.jar library, but also the following: gluegen-rt-natives-macosx-universal.jar, jogl-all.jar, gluegen-rt.jar, jogl-all-natives-macosx-universal.jar.

I suppose that what you are missing stands inside one of those, you can find them where you found the core.jar inside the processing package. Hope it helps :)

@matt0rtega
Copy link

Can't find that file in the source or Processing 4 downloaded from the site. Can you post the path that you have @WhiteSte ?

@WhiteSte
Copy link

Can't find that file in the source or Processing 4 downloaded from the site. Can you post the path that you have @WhiteSte ?

Not in the source, but in the built version: ...//Processing/Contents/Java/core/library

@github-actions
Copy link

This issue has been automatically locked. To avoid confusion with reports that have already been resolved, closed issues are automatically locked 30 days after the last comment. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Help Wanted We have very little time and would like some help macOS Issue is specific to macOS
Projects
None yet
Development

No branches or pull requests

8 participants