JVM hang with Swing and macOS
Martin Pernollet
martin.pernollet at protonmail.com
Tue Mar 21 17:39:47 UTC 2023
Hi,
Thank you Sergey, Michael and Alan.
It seams the [OGLUtilities does not exists anymore](https://github.com/openjdk/jdk/tree/master/src/java.desktop/macosx/classes/sun/java2d/opengl). Do you know if there is a replacer?
The current version of [PanamaGL](https://gitlab.com/jzy3d/panama-gl) is quite simple : it opens an opengl context, either with GLUT, either with the platform specific lib to do it (WGL on windows, GLX on Linux, CGL on macOS) and then performs offscreen rendering in a frame buffer. The result is then copied to a BufferedImage that is then [simply rendered by a Swing canvas](https://gitlab.com/jzy3d/panama-gl/-/blob/main/panama-gl-ui-swing/src/main/java/panamagl/canvas/GLCanvasSwing.java#L170). I know rendering through JAWT would be more efficient but this first step was easy to achieve in one shot for all platforms (and it works pretty well :).
Cheers,
Martin
Envoyé avec la messagerie sécurisée [Proton Mail](https://proton.me/).
------- Original Message -------
Le lundi 20 mars 2023 à 20:50, Sergey Bylokhov bylokhov at amazon.com a écrit :
> On 3/20/23 12:33, Michael Hall wrote:
>
>> /*
>> * We cannot use dispatch_sync here, because it blocks the main dispatch queue.
>> * Using the main NSRunLoop allows the dispatch queue to run properly once
>> * SWT (or whatever toolkit this is needed for) kicks off it's own NSRunLoop
>> * and starts running.
>> */
>> I would think the problem is that -XrunOnFirstThread is intended for ’toolkit’s that aren’t Swing based but handle the gui and NSRunLoop as indicated themselves - like Eclipse with SWT.
>
> For debug purpose you can try to remove this option and use the sun.java2d.opengl.OGLUtilities class
> instead, it was created specifically to support the JOGL library long time ago. Note that it is not
> public and can be problematic to access right now.
>
> It would be good to know how you actually render the OGL content to Swing/AWT via the java code. We
> have only one supported mechanism to do that -> via jawt from the native code using CALayer.
>
> --
> Best regards, Sergey.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/client-libs-dev/attachments/20230321/8cd869fe/attachment.htm>
More information about the client-libs-dev
mailing list