diff --git a/src/org/lwjgl/demo/bgfx/Demo.java b/src/org/lwjgl/demo/bgfx/Demo.java index 4477dc34..d950219b 100644 --- a/src/org/lwjgl/demo/bgfx/Demo.java +++ b/src/org/lwjgl/demo/bgfx/Demo.java @@ -84,46 +84,37 @@ protected void run(String[] args) { } }); - BGFXPlatformData platformData = BGFXPlatformData.calloc(stack); + /* Initialize bgfx */ + + BGFXInit init = BGFXInit.malloc(stack); + bgfx_init_ctor(init); + init + .type(renderer) + .vendorId(pciId) + .deviceId((short)0) + .callback(useCallbacks ? createCallbacks(stack) : null) + .allocator(useCustomAllocator ? createAllocator(stack) : null) + .resolution(it -> it + .width(width) + .height(height)); switch (Platform.get()) { case LINUX: - platformData.ndt(GLFWNativeX11.glfwGetX11Display()); - platformData.nwh(GLFWNativeX11.glfwGetX11Window(window)); + init.platformData().ndt(GLFWNativeX11.glfwGetX11Display()); + init.platformData().nwh(GLFWNativeX11.glfwGetX11Window(window)); break; case MACOSX: - platformData.ndt(NULL); - platformData.nwh(GLFWNativeCocoa.glfwGetCocoaWindow(window)); + init.platformData().ndt(NULL); + init.platformData().nwh(GLFWNativeCocoa.glfwGetCocoaWindow(window)); break; case WINDOWS: - platformData.ndt(NULL); - platformData.nwh(GLFWNativeWin32.glfwGetWin32Window(window)); + init.platformData().ndt(NULL); + init.platformData().nwh(GLFWNativeWin32.glfwGetWin32Window(window)); break; } - platformData.context(NULL); - platformData.backBuffer(NULL); - platformData.backBufferDS(NULL); - - bgfx_set_platform_data(platformData); - BGFXDemoUtil.reportSupportedRenderers(); - /* Initialize bgfx */ - - BGFXInit init = BGFXInit.malloc(stack); - bgfx_init_ctor(init); - init - .type(renderer) - .vendorId(pciId) - .deviceId((short)0) - .callback(useCallbacks ? createCallbacks(stack) : null) - .allocator(useCustomAllocator ? createAllocator(stack) : null) - .resolution(it -> it - .width(width) - .height(height) - .reset(reset)); - if (!bgfx_init(init)) { throw new RuntimeException("Error initializing bgfx renderer"); }