jME Version: 3.10 beta1
Renderer: LWJGL3 (Forcing LWJGL_OPENGL41)
When attempting to render an instanced chunk on macOS using lwjgl3, the JVM immediately aborts with a native error.
The engine correctly reports that it supports hardware instancing (Caps.MeshInstancing returns true). However, the com.jme3.renderer.lwjgl.LwjglGLExt renderer is currently hardcoded to reach for legacy ARB function pointers (e.g., ARBDrawInstanced.glDrawElementsInstancedARB). Because macOS stripped out legacy ARB extensions from its Core Profile drivers, the JVM crashes the moment the engine attempts to call the unavailable function, even when forcing LWJGL_OPENGL41.
To Reproduce
- Run a project on macOS using jME 3.10 beta1 with the lwjgl3 renderer.
- Ensure OpenGL Core Profile is requested (e.g., forcing LWJGL_OPENGL41).
- Attempt to render vegetation or any mesh utilizing hardware instancing.
- The application crashes immediately upon the first instanced draw call.
FATAL ERROR in native method: Thread[#3,jME3 Main,5,main]: No context is current or a function that is not available in the current context was called. The JVM will abort execution.
at org.lwjgl.opengl.ARBDrawInstanced.nglDrawElementsInstancedARB(Native Method)
at org.lwjgl.opengl.ARBDrawInstanced.glDrawElementsInstancedARB(ARBDrawInstanced.java:34)
at com.jme3.renderer.lwjgl.LwjglGLExt.glDrawElementsInstancedARB(LwjglGLExt.java:71)
at com.jme3.renderer.opengl.GLRenderer.drawTriangleList(GLRenderer.java:3659)
at com.jme3.renderer.opengl.GLRenderer.renderMeshDefault(GLRenderer.java:3791)
at com.jme3.renderer.opengl.GLRenderer.renderMesh(GLRenderer.java:3819)
at com.jme3.material.logic.DefaultTechniqueDefLogic.renderMeshFromGeometry(DefaultTechniqueDefLogic.java:73)
at com.jme3.material.logic.SinglePassAndImageBasedLightingLogic.render(SinglePassAndImageBasedLightingLogic.java:280)
at com.jme3.material.Technique.render(Technique.java:168)
at com.jme3.material.Material.render(Material.java:1122)
at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:899)
at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:805)
at com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:273)
at com.jme3.renderer.queue.RenderQueue.renderQueue(RenderQueue.java:321)
at com.jme3.renderer.RenderManager.renderViewPortQueues(RenderManager.java:1257)
at com.jme3.renderer.RenderManager.flushQueue(RenderManager.java:1071)
at com.jme3.renderer.pipeline.ForwardPipeline.pipelineRender(ForwardPipeline.java:117)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1441)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1425)
at com.jme3.renderer.RenderManager.render(RenderManager.java:1483)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:358)
at com.jme3.system.lwjgl.LwjglWindow.renderFrameWithBlitFramebuffer(LwjglWindow.java:941)
at com.jme3.system.lwjgl.LwjglWindow.runLoop(LwjglWindow.java:985)
at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:1149)
at com.jme3.system.lwjgl.LwjglWindow.create(LwjglWindow.java:709)
at com.jme3.app.LegacyApplication.start(LegacyApplication.java:510)
at com.jme3.app.LegacyApplication.start(LegacyApplication.java:485)
As a temporary fix, I wrote a custom version of LwjglGLExt and injected it into the render manager. I replaced all ARB calls with their core profile equivalents (e.g., swapping ARBDrawInstanced.glDrawElementsInstancedARB for GL31.glDrawElementsInstanced). With this injection, hardware instancing works perfectly on macOS.
jME Version: 3.10 beta1
Renderer: LWJGL3 (Forcing LWJGL_OPENGL41)
When attempting to render an instanced chunk on macOS using lwjgl3, the JVM immediately aborts with a native error.
The engine correctly reports that it supports hardware instancing (Caps.MeshInstancing returns true). However, the com.jme3.renderer.lwjgl.LwjglGLExt renderer is currently hardcoded to reach for legacy ARB function pointers (e.g., ARBDrawInstanced.glDrawElementsInstancedARB). Because macOS stripped out legacy ARB extensions from its Core Profile drivers, the JVM crashes the moment the engine attempts to call the unavailable function, even when forcing LWJGL_OPENGL41.
To Reproduce
As a temporary fix, I wrote a custom version of LwjglGLExt and injected it into the render manager. I replaced all ARB calls with their core profile equivalents (e.g., swapping ARBDrawInstanced.glDrawElementsInstancedARB for GL31.glDrawElementsInstanced). With this injection, hardware instancing works perfectly on macOS.