Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken dependencies adding imgui to a minecraft project #96

Closed
zeroeightysix opened this issue May 29, 2019 · 4 comments
Closed

Broken dependencies adding imgui to a minecraft project #96

zeroeightysix opened this issue May 29, 2019 · 4 comments

Comments

@zeroeightysix
Copy link
Collaborator

zeroeightysix commented May 29, 2019

I'm trying to create a fabric (minecraft mod environment) mod for minecraft (which uses LWJGL 3.2.1), using fabric's example mod build.gradle.

I'd like to add imgui as a library. However, adding it to the dependencies task like so:

implementation "com.github.kotlin-graphics:imgui:fc9aad3de1"

Will result in a lot of broken dependencies (all LWJGL):
image
(These show up as "FAILED" in the output of the dependencies task)

I presume this is because of the version mismatch between imgui (3.2.2) and minecraft (3.2.1) but, assuming LWJGL uses SemVer, both should be compatible, and we already have LWJGL in our classpath, so I assumed it was safe to exclude LWJGL from imgui:

implementation("com.github.kotlin-graphics:imgui:fc9aad3de1") {
    exclude group: "org.lwjgl"
}

Which, indeed, made the library resolveable:
image

Though, actually using it will yield a NoClassDefFoundError:

private static uno.glfw.glfw glfw = uno.glfw.glfw.INSTANCE;
private static ImGui imgui = ImGui.INSTANCE;
private static ImplGL3 implGl3;

static {
    glfw.init();
    implGl3 = new ImplGL3(); // Exception is thrown here
}
...
[00:08:30] [main/INFO]: [STDOUT]: java.lang.NoClassDefFoundError: gln/identifiers/GlProgram
[00:08:30] [main/INFO]: [STDOUT]: 	at imgui.impl.ImplGL3.<init>(ImplGL3.kt:39)
...

Looking up where gln.identifiers.GlProgram might come from on google, I can only find this repository. What am I doing wrong? Sorry if this is a duplicate of #42.

Thank you in advance.

@Sylvyrfysh
Copy link
Collaborator

Sylvyrfysh commented May 29, 2019

Hi!

We just went to a multi-project structure in order to allow for multiple rendering backends, and this problem looks related, but I'm not entirely sure what the issue is. My best guess would be that if you are using OpenGL, you should use this code for the ImGui dependency:

ext{
    imguiVersion = "fc9aad3de1"
}

["gl", "glfw", "core"].each {
    implementation("com.github.kotlin-graphics.imgui:imgui-$it:$imguiVersion") {
        exclude group: "org.lwjgl"
    }
}

This will grab the OpenGL branch and everything that it requires, which may fix your problem. If it doesn't, let em know and we'll try some other stuff.

On a side note, LWJLGL does not strictly follow SemVer, so code may break doe to the version difference. I've considered adding LWJGL version checks to use the proper code paths on load, but so far it hasn't seemed worth it.

@zeroeightysix
Copy link
Collaborator Author

Yup, that did the trick. Thank you!

@elect86
Copy link
Collaborator

elect86 commented May 31, 2019

@Sylvyrfysh , may it be worth adding that snippet in the README?

@Sylvyrfysh
Copy link
Collaborator

Sylvyrfysh commented May 31, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants