This has been working for me, with JOGL 2.3.2 and Java 8 on Apple M1. However, I have been having a devil of a time trying to upgrade to Java 11 and JOGL 2.4. GLWindow.create() seems to crash the JRE:
>> A fatal error has been detected by the Java Runtime Environment:
j java.lang.Class.forName(Ljava/lang/String;)Ljava/lang/Class;+11 firstname.lastname@example.org
Much of my research ends up with references that are years old. Is JOGL no longer being maintained and updated? Is there a better option for Java + OpenGL? I don't mean to complain - I know it's hard work (beyond my knowledge and skill set). I just thought there would be commercial entities interested in keeping some Java OpenGL solution alive and up to date.
My work doesn't make any money, but I can compile my Java work to the desktop and web. Unfortunately, my OpenGL desktop work is more unreliable than the web:
Could you post the complete JRE core dump to better understand?
In Jzy3D I export screenshots to BufferedImage as you do. I haven't noticed any problem under Java 11 with JOGL 2.4 on Apple M1 (see my compatibility test report here). Note that I use Azul JDK which was the only one available for M1. This avoid relying on Rosetta and will make use of the GL binding for M1 and not for Intel chips. Not sure this will change anything to your problem but worth knowing.
JOGL is maintained "a bit", but we mainly exchange tips for solving issues rather than fix bugs for now.
Other ways I know for working with OpenGL in Java
- LWJGL : I tried a bit 1.5 years ago and encountered lot of issues with the demo programs on macOS so I dropped.
- jGL : is an old implementation of OpenGL 1 in pure Java, without binding to native OpenGL. It works great in Jzy3D for charts with limited number of polygons. You can read how I integrated it in Jzy3D here.
- PanamaGL : is rather POC than a ready to use framework. It uses improvements of Java 17 to invoke native OpenGL. Not useable right now but interesting to watch in the future.
Your web/desktop app is really interesting. What tool do you use to build it?
Thank you for this! Sharing your LWJGL experience is helpful - I've been tempted to go off on that tangent, but I was worried it would just lead to a few weeks of frustration. I will also try Azul and see if that helps. I also might give jGL a try.
The secret to my web build is TeaVM (http://teavm.org) and SnapKit (https://github.com/reportmill/SnapKit), a UI kit I built for ReportMill to get to the web. It basically abstracts the platform functionality like Graphics2D and Web CanvasRenderingContext2D (as well as input events, clipboard, drag and drop, etc.). With SnapKit I can implement at a general level, then compile to desktop and/or web. TeaVM is a wonder - I'm a huge fan, and the author is an unheralded hero (IMO). Recently, I've started adding abstraction for 3D. It has a simple platform independent renderer, but then it has an adapter for OpenGL on the desktop and WebGL in the browser.
Thank you for the suggestion for AWTTextureIO! I plan to dive into textures for the first time next week. Maybe this will provide a new path for rendering that will side step my problem, since I really only need offscreen rendering. I will post an update here after I give it a try.