Null Context : OpenGL integration in SWT on Mac Aarch64 java 17

Started by bolivar, December 16, 2024, 22:22:52

Previous topic - Next topic

bolivar

Hello everyone,

I am trying to use an OpenGL canvas in SWT with Zulu 17 on Mac Aarch64.

To do so, I relied on the provided example SWTDemo but I got the following exception:

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "org.eclipse.swt.internal.cocoa.NSGraphicsContext.saveGraphicsState()" because "context" is null
   at org.eclipse.swt.widgets.Widget.drawRect(Widget.java:763)
   at org.eclipse.swt.widgets.Canvas.drawRect(Canvas.java:170)
   at org.eclipse.swt.widgets.Display.windowProc(Display.java:6124)
   at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
   at org.eclipse.swt.widgets.Display.applicationNextEventMatchingMask(Display.java:5398)
   at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5802)
   at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
   at org.eclipse.swt.internal.cocoa.NSApplication.nextEventMatchingMask(NSApplication.java:92)
   at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3877)
   at com.afp.iris.mpvlab.SwtDemo.main(SwtDemo.java:158)

Has anyone encoutered this issue ? If so I will very appreciate any tips or workaround.

Thank you

Bolivar