imgui icon indicating copy to clipboard operation
imgui copied to clipboard

ImGui can't access static fields and members of org.lwjgl.stb.STBRPRect

Open Cavantar opened this issue 3 years ago • 3 comments

Hi I've been trying to solve this for a day and I don't really know what else to do. I'm using imgui v1.79, lwjgl 3.3.1 and jdk11. For some reason app crashes inside the lib with:

Exception in thread "main" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NoSuchMethodError: org.lwjgl.stb.STBRPRect.nw(JS)V
	at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:172)
	at com.jbidev.nothing.DesktopLauncher.main(DesktopLauncher.java:17)
Caused by: java.lang.NoSuchMethodError: org.lwjgl.stb.STBRPRect.nw(JS)V
Caused by: java.lang.NoSuchMethodError: org.lwjgl.stb.STBRPRect.nw(JS)V

	at imgui.stb.ExtensionsKt.setW(extensions.kt:30)
	at imgui.font.FontAtlas.buildWithStbTrueType(FontAtlas.kt:720)
	at imgui.font.FontAtlas.build(FontAtlas.kt:202)
	at imgui.font.FontAtlas.getTexDataAsAlpha8(FontAtlas.kt:212)
	at imgui.font.FontAtlas.getTexDataAsRGBA32(FontAtlas.kt:222)
	at imgui.impl.gl.ImplGL3.createFontsTexture(ImplGL3.kt:225)
	at imgui.impl.gl.ImplGL3.createDeviceObjects(ImplGL3.kt:275)
	at imgui.impl.gl.ImplGL3.newFrame(ImplGL3.kt:61)

I can easily access stb methods and constants from the main app, but inside the imgui lib I can only create instances and access class methods, static members don't work at all giving error:

Symbol is declared in module 'org.lwjgl.stb' which current module does not depend on

Does anybody knows, how to fix this, is this caused by my setup ? I don't have much experience with gradle and kotlin so any help would be appreciated .

Cavantar avatar Jul 31 '22 09:07 Cavantar

As far as I can tell, the issue is that kotlin-imgui passes in a short to a function that expects an int, however I thought Java does primitive widening so that shouldn't be the case.

tasgon avatar Aug 01 '22 09:08 tasgon

Hey guys,

The likely issue here is an lwjgl version mismatch. If the version you are developing with doesn't match the version in ImGui, constants and static variables might move, making that variable inaccessible as you've seen. I will look at this later, time permitting.

Thanks! Nick

On Mon, Aug 1, 2022, 02:46 Mihai P @.***> wrote:

As far as I can tell, the issue is that kotlin-imgui passes in a short to a function that expects an int, however I thought Java does primitive widening so that shouldn't be the case.

— Reply to this email directly, view it on GitHub https://github.com/kotlin-graphics/imgui/issues/179#issuecomment-1200971091, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADTJ6QCZAMPVHK2LRUSKB5DVW6MIRANCNFSM55ES4C6A . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Sylvyrfysh avatar Oct 11 '22 09:10 Sylvyrfysh

Sorry for the delay, I just updated it, could you give it a try?

implementation("kotlin.graphics:imgui-core:1.79+05")
implementation("kotlin.graphics:imgui-gl:1.79+05")
implementation("kotlin.graphics:imgui-glfw:1.79+05")

elect86 avatar Nov 03 '22 09:11 elect86