Post not yet marked as solved
Post marked as unsolved with 1 replies, 2,293 views
Dear experts, I'm working on adding UI for my cpp based path tracer renderer.
I want to create metal cpp device and pass it to renderer, but also I want to use ImGui and GLFW (for window manager and input events handling). I've found solution how I can mix obj c code that requires by GLFW window setup and cpp code: https://github.com/ikryukov/MetalCppImGui
// Here is key thing for integration GLFW with Metal Cpp
// GLFW supports only obj c window handle
NSWindow *nswin = glfwGetCocoaWindow(window);
CA::MetalLayer* layer = CA::MetalLayer::layer();
layer->setDevice(device);
layer->setPixelFormat(MTL::PixelFormatBGRA8Unorm); // bridge to obj c here because NSWindow expetcs objc
CAMetalLayer* l = (__bridge CAMetalLayer*)layer;
nswin.contentView.layer = l;
nswin.contentView.wantsLayer = YES;
Is there any official way to handle event in Metal cpp without objective c support? Maybe MetalKit will have such features in future?