{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreic5vlhxls3rhohrnnlv4xyn5gxx66pxo4sft4tugc3apji6nzge6u",
    "uri": "at://did:plc:dxjzgxe7cvirxkwfjr2tjspt/app.bsky.feed.post/3mh3paagbaij2"
  },
  "path": "/t/an-attempt-at-vulkan/49433#post_10",
  "publishedAt": "2026-03-14T23:49:53.000Z",
  "site": "https://hub.jmonkeyengine.org",
  "tags": [
    "https://youtu.be/eYkkGzoRzkU",
    "@Override"
  ],
  "textContent": "https://youtu.be/eYkkGzoRzkU\nA piece of good news: I can now successfully use most of the frontend functionalities in jMonkeyEngine 3.\n\n\n    package com.jme3.lwjgl.test;\n\n    import com.jme3.app.FlyCamAppState;\n    import com.jme3.app.LegacyApplication;\n    import com.jme3.asset.plugins.ClasspathLocator;\n    import com.jme3.input.FlyByCamera;\n    import com.jme3.input.RawInputListener;\n    import com.jme3.input.event.JoyAxisEvent;\n    import com.jme3.input.event.JoyButtonEvent;\n    import com.jme3.input.event.KeyInputEvent;\n    import com.jme3.input.event.MouseButtonEvent;\n    import com.jme3.input.event.MouseMotionEvent;\n    import com.jme3.input.event.TouchEvent;\n    import com.jme3.material.Material;\n    import com.jme3.material.plugins.J3MLoader;\n    import com.jme3.math.ColorRGBA;\n    import com.jme3.math.Vector3f;\n    import com.jme3.renderer.Camera;\n    import com.jme3.renderer.ViewPort;\n\n    import com.jme3.scene.Geometry;\n    import com.jme3.scene.Node;\n    import com.jme3.scene.shape.Box;\n    import com.jme3.scene.shape.Quad;\n    import com.jme3.system.AppSettings;\n    import com.jme3.system.JmeSystem;\n    import com.jme3.system.VulkanSystemDelegate;\n\n    public class VulkanMaterialUnshadedApp extends LegacyApplication {\n\n        private Node rootNode = new Node(\"Root\");\n        private ViewPort viewPort;\n        private Camera cam;\n\n        private FlyCamAppState flyCamState;\n        private boolean flyConfigured = false;\n\n        @Override\n        public void initialize() {\n            super.initialize();\n            assetManager.registerLocator(\"/\", ClasspathLocator.class);\n            assetManager.registerLoader(J3MLoader.class, \"j3md\", \"j3m\");\n\n            cam = getCamera();\n            viewPort = renderManager.createMainView(\"Main\", cam);\n            viewPort.attachScene(rootNode);\n\n            Quad q = new Quad(1f, 1f);\n            Geometry g = new Geometry(\"quad\", q);\n\n            Material m = new Material(assetManager, \"Common/MatDefs/Misc/Unshaded.j3md\");\n            m.setColor(\"Color\", ColorRGBA.White);\n            g.setMaterial(m);\n            rootNode.attachChild(g);\n\n            cam.setLocation(new Vector3f(0, 0, 10f));\n            cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);\n            cam.setFrustumPerspective(45f, (float) cam.getWidth() / cam.getHeight(), 0.1f, 100f);\n\n            flyCamState = new FlyCamAppState();\n            flyCamState.initialize(stateManager, this);\n            stateManager.attach(flyCamState);\n\n            // 不要在这里立刻 getCamera() 配置\n            // 验证输入对象是否为 GLFW 真实实现\n            inputManager.addRawInputListener(new RawInputListener() {\n                @Override\n                public void beginInput() {\n                }\n\n                @Override\n                public void endInput() {\n                }\n\n                @Override\n                public void onKeyEvent(KeyInputEvent evt) {\n                    if (evt.isPressed()) {\n                        System.out.println(\"KEY pressed: \" + evt.getKeyCode());\n                    }\n                }\n\n                @Override\n                public void onMouseMotionEvent(MouseMotionEvent evt) {\n                }\n\n                @Override\n                public void onMouseButtonEvent(MouseButtonEvent evt) {\n                }\n\n                @Override\n                public void onJoyAxisEvent(JoyAxisEvent evt) {\n                }\n\n                @Override\n                public void onJoyButtonEvent(JoyButtonEvent evt) {\n                }\n\n                @Override\n                public void onTouchEvent(TouchEvent evt) {\n                }\n            });\n    //        FlyByCamera flyCam = flyCamState.getCamera();\n    //        flyCam.setMoveSpeed(5f);\n    //        flyCam.setDragToRotate(false);\n    //        flyCam.registerWithInput(inputManager);\n\n        }\n\n        @Override\n        public void update() {\n            super.update();\n\n            float tpf = timer.getTimePerFrame();\n\n\n\n            // 3) scene 更新 + 渲染\n            rootNode.updateLogicalState(tpf);\n            rootNode.updateGeometricState();\n\n            if (context != null && context.isRenderable()) {\n                renderManager.render(tpf, true);\n            }\n        }\n\n        public static void main(String[] args) {\n            JmeSystem.setSystemDelegate(new VulkanSystemDelegate());\n\n            AppSettings s = new AppSettings(true);\n            s.setCustomRenderer(com.jme3.renderer.vulkan.LwjglVulkanContext.class);\n            s.setWidth(1280);\n            s.setHeight(720);\n\n            VulkanMaterialUnshadedApp app = new VulkanMaterialUnshadedApp();\n            app.setSettings(s);\n            app.start();\n        }\n    }\n\n\n\nThe current issue is how to handle the shaders. I might need to go to the library as I haven’t found any information about OpenGL compatibility with Vulkan on the internet. If anyone else has any findings, please let me know.",
  "title": "An attempt at Vulkan"
}