Closed orange451 closed 2 years ago
The main reason why the methods are called that way and why there are so many of them is JOGL. Initially the project was based on it. And to make the transition from Swing/SWT JOGL smoother, I left the methods roughly the same. Default JOGL event listener includes:
GLAutoDrawable drawable
that used to call GL functions, in my library (with lwjgl) is redudant
So they transformes to:
Also comes from JOGL, listeners may be more than one for each event. So, set*****
will be incorrect.
The library was planned simply as an add-on to JavaFX, which displays OpenGL separately. The goal was not to fully integrate with Property or Events
I created a proof-of-concept that wraps around your OpenGLCanvas class. https://github.com/orange451/OpenGLFX-Ext/blob/master/src/main/java/com/huskerdev/openglfx/ext/OpenGLPane.java
Benefit to using JavaFX events, is I can easily pass in internal parameters. For example in the RenderEvent I can pass in the current timers delta time.
It also lets me have the OpenGLPane act as a layout manager by extending StackPane, so it can have its own children nodes.
I added Events. But not properties. You can test them.
I think at the moment the event syntax has come as close as possible to the example. Therefore, I will close the issue. If there are any questions, then you can reopen.
JavaFX Node class commonly uses events like so:
It would be more in the spirit of JavaFX if OpenGLCanvas used a similar style for:
An example of this could be...