Open
Description
Hello,
I'm trying to use my own GLFW window to draw Jimgui instead of the default one it creates, however I keep getting errors and crashing, perhaps a bug or wrong usage? Thank you.
public static void main(String[] args) {
JniLoader.load();
glfwSetErrorCallback(errorCallback);
glfwWindowHint(GLFW_ALPHA_BITS, 8);
glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GL_TRUE);
glfwWindowHint(GLFW_DECORATED, GL_FALSE);
long window = glfwCreateWindow(800, 800, "Test", 0, 0);
if (window == 0) {
System.exit(1);
}
glfwMakeContextCurrent(window);
GL.createCapabilities();
glfwSwapInterval(1);
glfwSetKeyCallback(window, keyCallback);
JImGui gui = JImGui.fromExistingPointer(window);
gui.initBeforeMainLoop();
while (!glfwWindowShouldClose(window)) {
glViewport(0, 0, 800, 800);
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
gui.initNewFrame();
gui.text("This is gui");
gui.render();
}
glfwDestroyWindow(window);
glfwTerminate();
System.out.println("Terminated.");
System.exit(0);
}