Comments (16)
I'm new with imgui too and am only helping with keeping the stable branch updated, but I felt I could possibly help because I know some things about libGDX.
I tried it out now and I see, it creates its own window instead of integrating into an existing gl/glfw context. I'll see the coming week if I can fork this and create a integrating GlfwWindow if @elect86 hasn't already done something similar by then.
Lwjgl3 uses glfw, so it should work fine in GDX too, but there is more to it than just a a window handle as GlfwWindow also takes it upon itself to manage the glfw lifetime, which it can't be allowed to do if we want it to be possible to integrate it into an existing context.
if you want to try something yourself in the mean, you can get the Lwjgl3Window with
(Gdx.graphics as Lwjgl3Graphics).window
It has a private field Long windowHandle
(that you can reach by reflection) that holds the glfw window handle.
from imgui.
Quick info, I'm trying to substitute the all the queries to the windowHandle: Long
with others to Gdx.graphics
.. I'll see and let you know where I will end up
from imgui.
Ok, it should work now
I tried first to make it work by substituting completely the uno GlfwWindow
with single manual calls to Gdx.graphics
Then it was too messy/shitty, I reverted and tried to obtain that damned windowHandle because I had one hope, to init GlfwWindow
by that.. because if that worked, than the code impact would have been very minimal (and also the changes to write :D)
It helped a lot @TTSKarlsson tips (also his stackoverflow question)
One last obstacles was that I couldn't retrieve a private field or a package-only method, google helped and I just had to make it accessible before retrieving
I modified then GlfwWindow
accordingly to offer a constructor starting from the pure handler..
Another one last obstacles, I discovered I couldn't load the imgui shaders with the simple getSystemResource
, I needed the bloody asStream
Packed all the shits together, thanks god worked.. (coz also I didnt have more time)
@Catvert, would be nice if you could spend some time expanding the readme and writing about it, in order to help people seeking the same
from imgui.
Nice to see it came to a solution, and clever constructor work there @elect86 ! =)
from imgui.
Hi Catvert,
are you working on an open source project I may clone and check that out?
from imgui.
Yes, you can try it with: https://github.com/Catvert/Platform-Creator. Normally, it should have no problem configuring the project.
from imgui.
Ok, cloned and synced. Can you introduce me a little about structure or point me toward one main class to run?
from imgui.
Yes of course, after importing it as a gradle project, you should have 4 modules (Platform-Creator, core, desktop and lwjgl3). There are 2 main class, for both backends(lwgl2 -> DesktopLauncher, lwgl3 -> Lwgl3Launcher). The game class is in the core module, PCGame. Thanks you for your help ! :)
from imgui.
If you're using Intellij Idea, you can open the gradle tool window in View -> Tool Window -> Gradle. With this window, so you can refresh the project to make sure that gradle has downloaded all dependencies.
To create the run configuration, create a new Application configuration then select for the main class DesktopLauncher or Lwgl3Launcher. And for the module, desktop_main or lwjgl3_main.
from imgui.
Hi, sorry to ask this, but I would like to know if you are working on a wrapper for libGDX? I can help if you want to, I think it might be a good idea given the number of libGDX users. Thank you very much.
from imgui.
@Catvert , What is your error when you use the Lwjgl3Launcher with imgui?
I had to add the same run configuration as in your desktop project
run {
setWorkingDir(workingDir.absolutePath + "/../")
ignoreExitValue = true
}
or it wouldn't find the assets. But after that it runs the app under Lwjgl3 just fine.
When you add imgui you'll also need to add maven { url "https://dl.bintray.com/kotlin/kotlin-dev" }
to your buildscript repositories because imgui's dependencies still bundles kotlin future runtimes and compiles against the experimental/alpha/beta branch of kotlin. You'll get some warnings as kotlin is explicitly not future compatible.
There is a kotlin-stable branch of imgui, but the other jitpack dependencies has not gotten similar treatment just yet, an open issue about this is pending.
I hope this helps, and please tell us if you get it working or if not. If you don't, and still want to, please create and push a branch to your repo with your attempted code of imgui and I will try to take a look at it as I'm used to the libGDX structure.
from imgui.
Hi @TTSKarlsson, I have no problem adding Imgui to my project but I can't configure Imgui from imgui.impl.LwjglGL3 because it seems to me that this implementation uses uno-sdk. It is therefore impossible for me to "pass" the libGDX window to the LwjglGL3 init method (which requires a GlfwWindow). Do I need to recreate a new implementation for libGDX based on this one?
from imgui.
Small update: I pulled libgdx to make Lwjgl3Window.getWindowHandle()
as public
and avoiding in this way to use reflection to retrieve it.
It's been right now merged by tom, we should change that as soon as the next release comes out.
The first one who remembers that (maybe you can keep an eye on that, @Catvert?) can do that :)
from imgui.
Wow, your solution works perfectly! Thank you very much, I will explain in the readme how to set up imgui with libGDX :) (I don't speak English very well but I will try to do my best).
from imgui.
@elect86 Can I create a page in the wiki to explain how to configure imgui with libGDX? I think it might be clearer.
from imgui.
You are welcome, Catvert :)
Sure, what you think works best. I'm not an english native as well but I might take a look at that if you want, when you are done
from imgui.
Related Issues (20)
- Example Log doesn't display any text unless a filter is applied HOT 1
- is jdk8-snapshot doesnt work anymore? HOT 1
- Shaders do not compile on M1 (macOS 11.4) HOT 3
- Methods need unecessary parameters when used in java HOT 3
- Some clear, modern example would help
- Unable to load ForwardDeclarationsKt when using Java modules HOT 2
- Use of `static` in package identifier can cause Java interoperability problems HOT 1
- MainMenuBar causes NullPointerException when clicking on free space HOT 1
- `listbox` shows no items
- ImGui can't access static fields and members of org.lwjgl.stb.STBRPRect HOT 3
- Invalid Package name HOT 3
- Index 33619455 out of bounds for length 0 HOT 1
- Documentation still references dl.bintray.com (shutdown nearly two years ago) HOT 1
- Is there a version of imgui for kotlin that works with lwjgl 3.3.1 HOT 7
- Cant get VertexBuffer data from DrawList class HOT 27
- Update Wiki HOT 1
- java.lang.NoClassDefFoundError: uno/glfw/HWND HOT 4
- Rendering artifacts on non-square elements HOT 1
- useBufferSubData breaks rendering completely, if set to true
- NoClassDefFoundError: uno/glfw/HWND HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imgui.