<div style="font-family: Arial; font-size: 14px;">Hi everyone,</div><div style="font-family: Arial; font-size: 14px;"><br></div><div style="font-family: Arial; font-size: 14px;">I am back on track with OpenGL binding with Panama!</div><div style="font-family: Arial; font-size: 14px;"><br></div><div style="font-family: Arial; font-size: 14px;">I have one code design / tooling question related to JExtract : is it possible to <b>generate a common interface that would be implemented by all platform specific binding</b> generated by JExtract since JDK 19 or 20?</div><div style="font-family: Arial; font-size: 14px;"><br></div><div style="font-family: Arial; font-size: 14px;">Here's my use case in more detail : I've been advised to generate <b>different binding for different OS</b> (and maybe version). For OpenGL, this lead me to a glut_h binding for macOS, one for Windows and one for Linux.</div><div style="font-family: Arial; font-size: 14px;"><br></div><div style="font-family: Arial; font-size: 14px;">To let <b>the user/developer face a single entry point</b>, I manually write a <a href="https://github.com/jzy3d/panama-gl/blob/feature/fbo/src/main/java/opengl/GL.java" title="GL interface">GL interface</a>. I then define a <a href="https://github.com/jzy3d/panama-gl/blob/feature/fbo/src/main/java/opengl/macos/GL_macOS_10_15_3.java" title="GL_macOS_10_15_3">GL_macOS_10_15_3</a> class that wraps the binding (!). When I expand the prototype to Windows, I should copy paste this to GL_Windows_10 and modify the imports to reference the appropriate bindings. The goal is to write code like this</div><div style="font-family: Arial; font-size: 14px;"><br></div><div style="font-family: Arial; font-size: 14px;">GL gl = Platform.selectAmong(GL_macOS_10_15_3.class, GL_windows_10.class, ...)</div><div style="font-family: Arial; font-size: 14px;">gl.glDoSomething()</div><div style="font-family: Arial; font-size: 14px;"><br></div><div style="font-family: Arial; font-size: 14px;">I don't think there would be another way to have java developer write <b>applications that ignore the target hardware</b>. However my approach is stupid : time consuming and error prone because manual. A real life case may have 10 implementations and 1000 functions.</div><div style="font-family: Arial; font-size: 14px;"><br></div><div style="font-family: Arial; font-size: 14px;"><b>Does JExtract provide a solution to this</b>? Should I create this tool by myself based on all generated bindings ? Would anyone <b>recommend something smarter</b>?</div><div style="font-family: Arial; font-size: 14px;"><br></div><div style="font-family: Arial; font-size: 14px;">Regards,</div><div style="font-family: Arial; font-size: 14px;"><br></div><div style="font-family: Arial; font-size: 14px;">Martin </div><div style="font-family: Arial; font-size: 14px;"><br></div><div class="protonmail_signature_block" style="font-family: Arial; font-size: 14px;">
</div>