Git Product home page Git Product logo

Comments (14)

Catvert avatar Catvert commented on May 31, 2024 1

I use KTX in my project, you can check out if you want : https://github.com/Catvert/Platform-Creator
Have a look at this project too : https://github.com/Catvert/Imgui-test, its a simple example with LibGDX but without kTX but you can adapt the code easily.

from imgui.

Datoh avatar Datoh commented on May 31, 2024 1

I found the problem, nothing is drawn unless I call:

if (ImGui.drawData != null) LwjglGL3.renderDrawData(ImGui.drawData!!)

However, I have a JavaVM crash after 10s, it occurs even if I call only LwjglGL3.newFrame()

crash log (hs_err_pid4212.log): https://pastebin.com/cV5hKTbR

the interesting part of the log seems to be:
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) J 1075 org.lwjgl.system.JNI.invokePPPV(JJJJ)V (0 bytes) @ 0x0000000004e83f4e [0x0000000004e83f00+0x4e] J 1295 C1 uno.glfw.GlfwWindow.getFramebufferSize()Lglm_/vec2/Vec2i; (111 bytes) @ 0x00000000050c4d04 [0x00000000050c4340+0x9c4] J 1465 C1 imgui.impl.LwjglGL3.newFrame()V (1106 bytes) @ 0x000000000518a6c4 [0x0000000005186480+0x4244] J 1545 C1 com.datoh.lifekt.desktop.Game.render(F)V (50 bytes) @ 0x0000000005272dc4 [0x0000000005272b40+0x284] J 1488 C1 ktx.app.KtxGame.render()V (65 bytes) @ 0x00000000051aad7c [0x00000000051aaa00+0x37c] J 1422 C1 com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.update()Z (213 bytes) @ 0x0000000005128ddc [0x0000000005127d80+0x105c] j com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.loop()V+101 j com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lcom/badlogic/gdx/ApplicationListener;Lcom/badlogic/gdx/backends/lwjgl3/Lwjgl3ApplicationConfiguration;)V+257 j com.datoh.lifekt.desktop.KtxSampleAppKt.main([Ljava/lang/String;)V+67 v ~StubRoutines::call_stub

from imgui.

elect86 avatar elect86 commented on May 31, 2024 1

Yes, a short explanation is here here (but I'll add it in the wiki)

This is the appBuffer object.

It's thread-safe and fast because you pay only a single allocation overhead at begin of your app and then one clear per frame. From there any "allocation" is just dummy, that is a call to intAtomic

Basically it's suitable for any short-live native allocations, included OpenGL and Vulkan native resources, as well as GLFW. Plus anything else the user may ever need

It gets automatically called if you use the window.loop { }, otherwise you have to do it manually

Ps: you should also call it in the reshape, because if the user start resizing the window dragging for a time long enough he will fill it up

from imgui.

Datoh avatar Datoh commented on May 31, 2024 1

Thanks a lot for the support !

from imgui.

elect86 avatar elect86 commented on May 31, 2024

Hi!

unfortunately that is not possible. It'd be cool, but there seems to be no way at the moment.

But we can simply pass the array itself with an index.

checkbox(value.name, enum1ArrayEnabled, index)

I just pushed, give it a look

from imgui.

Datoh avatar Datoh commented on May 31, 2024

I used imgui-kotlin 1.53 and lwjgl 3.1.5
I moved to imgui-kotlin master and lwjgl 3.1.7

But now, I have the following error at run : Caused by: java.lang.Error: No current context. Did you call ImGui::Context() or ImGui::setCurrentContext()?

I add a context creation but imGui is not displayed anymore:

class Application : KtxGame<Screen>() {
    private val context = Context()
    private var contextImGui: imgui.Context? = null

    override fun create() {
        val window = GlfwWindow((Gdx.graphics as Lwjgl3Graphics).window.windowHandle)
        contextImGui = imgui.Context()

        LwjglGL3.init(window, false)

        context.register {
            bindSingleton<Viewport>(ScreenViewport())
            bindSingleton<Batch>(SpriteBatch())
            bindSingleton(Stage(inject(), inject()))
            bindSingleton(this@Application)
            bindSingleton(Game(inject(), inject()))
        }

        addScreen(context.inject<Game>())
        setScreen<Game>()
    }

    override fun dispose() {
        contextImGui?.destroy()
        LwjglGL3.shutdown()
        super.dispose()
    }
}

In more had a compilation error that I remove for now (imgui.IO.wantCaptureMouse is not anymore recognized)

from imgui.

elect86 avatar elect86 commented on May 31, 2024

That Error is thrown whenever gImGui is still null when you want to use imgui to render some gui

Theoretically, after you instantiate the imgui.Context(), gImGui shouldn't be null anymore. Check that

wantCaptureMouse is there, I have no idea why you can't see it

from imgui.

Datoh avatar Datoh commented on May 31, 2024

gImGui is initilialized.

Do you know why the imGui window is not displayed?

from imgui.

elect86 avatar elect86 commented on May 31, 2024

It's very hard to know why without having access to some code.

What I can suggest you, is to start from the tests and then build it up from there

from imgui.

Datoh avatar Datoh commented on May 31, 2024

I understand but I really would like to use Ktx...

Here is my build.gradle and standalone file sample app (maybe it would be nice to add it as test app):

build.gradle: https://pastebin.com/rfDtvZPQ
KtxSampleApp.kt: https://pastebin.com/NJAH1Gpt

from imgui.

Datoh avatar Datoh commented on May 31, 2024

@Catvert I have the same crash on your project https://github.com/Catvert/Platform-Creator

I don't have it on Imgui-test

I use JDK 1.8

from imgui.

elect86 avatar elect86 commented on May 31, 2024

Try add appBuffer.reset() in your loop

I'll expand the wiki soon about that

from imgui.

Datoh avatar Datoh commented on May 31, 2024

It works !

But it is a good practice to reset the buffer each frame?

from imgui.

elect86 avatar elect86 commented on May 31, 2024

I'll close it, if it's fine for you

from imgui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.