Closed ejamshidiasl closed 3 years ago
As you can see many people have paid their souls trying to achieve this but failed:
Contribution is welcomed
i can run 2 windows side by side but i want to run imgui window inside lwjgl i am working on it now....
i can run 2 windows side by side
wut? wut name/version/config of os/jre/lwjgl r u using?
Theoretically, exposing ImGui::CreateContext
should make this possible, but I haven't tried
Btw,
i used it in java applciation and it is really good
what is applciation?
import org.ice1000.jimgui.JImGui;
import org.ice1000.jimgui.util.JniLoader;
import org.lwjgl.glfw.GLFW;
public class Main {
public Main(){
GLFW.glfwInit();
long window = GLFW.glfwCreateWindow(400,400,"window1",0,0);
GLFW.glfwMakeContextCurrent(window);
GLFW.glfwSwapInterval(1);
GLFW.glfwShowWindow(window);
JniLoader.load();
try (JImGui imGui = new JImGui()) {
// load fonts, global initializations, etc.
imGui.initBeforeMainLoop();
while (!imGui.windowShouldClose()) {
// some drawing-irrelated initializations
// mostly do nothing here
imGui.initNewFrame();
// draw your widgets here, like this
imGui.text("Hello, World!");
imGui.render();
}
}
while (GLFW.glfwWindowShouldClose(window) == false){
GLFW.glfwPollEvents();
}
GLFW.glfwTerminate();
}
public static void main(String[] args){
new Main();
}
}
@ejamshidiasl you really should learn how to post codeblocks on github: https://help.github.com/en/articles/creating-and-highlighting-code-blocks
thanks (for code blocks)
what is applciation? ---> application
Try JImGui.fromExistingPointer
OS: win 10 IDE: intellij idea lwjgl: latest release
i found something in JImGui imGui = new JImGui() there is an argumant that gets anotherWindow handle i am trying this now
wut
Try
JImGui.fromExistingPointer
@ejamshidiasl
wha is nativeObjectPtr?
i find something cool i think problem is in imGui.initBeforeMainLoop() function because it loads other window handle
may i ask you to change constructor? line 222 file JImGui.java please add input argument (long window)
I was just wrapping the native API of glfw, I have no idea how they work
You can use reflection to access the private initBeforeMainLoop(long)
function, and prove it works, and then I can make the function public.
Hello i downloaded new version on jimgui and now i can render it to lwjgl window but there is a problem. imgui draws on top of lwjgl so i cannot see any opengl. maybe problem is in initNewFrame
I have no idea, you can dig imgui itself if you'd like to
Hello i downloaded new version on jimgui and now i can render it to lwjgl window but there is a problem. imgui draws on top of lwjgl so i cannot see any opengl. maybe problem is in initNewFrame
Could you post the code for / make a new repository to show how you achieved this?
It occured to me that JImGui is trying to use DirectX on Windows which makes it incompatible with LWJGL. However I'm not 100% sure of this guess: is it true? If ture, how can I manually choose to use the glfw+opengl3 version?
I don't know. There used to be a glfw+ogl3 native library, but I can't recall how to use it.
Any update for this issue? im using libgdx for a project and libgdx itself spawns a window, while imgui spawns another. My goal was to render imgui inside the libgdx existing window. I can have access to the libgdx windowhandle but passing it as argument to JImGui constructor doesnt seem to change anything. Maybe im doing something wrong?
Using gui=JImGui.fromExistingPointer(windowHandle) makes the program crash and a dump is returned. Using gui=new JImGui(width,height,atlas,title,windowHandle) doesnt change anything, 2 windows appears anyway.
UPDATE: it seems on linux JImGui.fromExistingPointer(handle) doesnt crash at startup , i have only 1 window shown, but i receive an error inside the gui.render() function that makes the program crash. Im using Arch Linux and lwjgl3.
The error is the following
java: /home/ice1000/git-repos/glfw/src/posix_thread.c:64: _glfwPlatformGetTls: assertion "tls->posix.allocated == GLFW_TRUE" failed.
Any idea @ice1000 ?
Why was this issue closed? I'm still not able to get this working in LibGDX.
Why was this issue closed? I'm still not able to get this working in LibGDX.
Me neither
Hello i used it in java applciation and it is really good thanks
is it possible to add it to lwjgl glfw window?