Skip to content

SWTDemo sample issue on Mac OS Aarch64: Cannot invoke "org.eclipse.swt.internal.cocoa.NSGraphicsContext.saveGraphicsState()" because "context" is null #1029

Description

@bolivaro

Version

3.3.5, 3.3.4

Platform

macOS arm64

JDK

Zulu 17

Module

OpenGL

Bug description

I am trying to intregrete an OpenGL Canvas in SWT on a Mac M2 Aarch64 with Java 17.

I initially try to embedded the GLcanvas into SWT context from a hand made snippet, then I got this null pointer exception from the context object.
To make sure I was doing everything the right way, I took one of your provided examples about OpenGL integration in SWT, the SWTDemo one, but I still got the same exception.

Has anyone encoutered this issue, and hopefully knows how to deal/get around with this.

Thank you

Stacktrace or crash log output

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions