Skip to content

nanovg without hello_imgui #259

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

Open
Yves33 opened this issue Oct 2, 2024 · 2 comments
Open

nanovg without hello_imgui #259

Yves33 opened this issue Oct 2, 2024 · 2 comments
Labels
faq A frequent issue, remaining opened to facilitate discoverability

Comments

@Yves33
Copy link

Yves33 commented Oct 2, 2024

Hello,
Is there a way to use nanovg with pure python backends (glfw)?
(it works for imnodes and implot)
It seems that the functions required to setup contexts are missing from the bindings.

nvgCreateGL2()
nvgCreateGL3()
nvgSetupGL2()
nvgSetupGL3()
@pthom
Copy link
Owner

pthom commented Oct 3, 2024

Hello,

It will not be possible to access nanovg from a pure python backend.

After a long investigation, I found that any call to openGL functions will fail on the C++ side since no OpenGL loader was initialized on this side (OpenGL and glfw ared only initialized on the Python side).

Getting this to work would require

  • passing glfw.get_proc_address from python to C++
  • initializing the glad loader on the C++ side from this address, and hope for the best

I tried it, it failed, and I later gave up, since this is getting way tricky.

@Yves33
Copy link
Author

Yves33 commented Oct 3, 2024

Thanks for investigating. I'll investigate using python_nanovg bindings from scratch.
Great job anyway!

Edit:
I was able to use nanovg in combination with imgui_bundle in a pure glfw backend using bindings from https://github.com/inniyah/nanovg
Which raises the following questions/suggestions:

  • Would it be possible to build imgui_bundle (python bindings) without nanovg (in order to avoid duplicating nanovg code)
  • More generally, it would be great if it was possible to build only with imgui related stuff:
    (no Hello_imgui, no im_app, no emscripten and no android/ios support), and choose module im* modules to be included (maybe a stripped down version of this repo with only imgui-implot-imnodes) and instructions to add other modules

@pthom pthom added the faq A frequent issue, remaining opened to facilitate discoverability label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
faq A frequent issue, remaining opened to facilitate discoverability
Projects
None yet
Development

No branches or pull requests

2 participants