-
Notifications
You must be signed in to change notification settings - Fork 525
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
Nuklear example #50
Comments
good idea, I have one here for Oryol: https://github.com/floooh/oryol-samples/blob/master/src/NuklearUIBasic/NuklearUIBasic.cc, should be fairly easy to adopt |
Hi @floooh, I've been trying to do this myself by modifying the nuklear_sdl_gl3 example. Here's my work-in-progress. I'm very inexperienced at opengl and graphics programming, so for give my naiveté, but it seems sokol_gfx needs to support a version of sg_draw which can take in an offset, since it seems nuklear dumps all the data into the same buffer. Oryol has this feature, so maybe sokol should as well? Again, I'm very new to all this, so my apologies for being presumptuous. Thanks, btw, for the very cool library. The code's very readable, and I'm learning a lot by using/reading it. |
Never mind, I found that draw_state has index_buffer_offset which should work fine. I'm now trying to figure out how to translate glMapBuffer into sokol_gfx. I guess since sokol_gfx aims to be compatible with gles2, it won't have the functionality equivalent to glMapBuffer? In which case, I'm guessing I'd need to duplicate buffers in CPU and GPU, and then use sg_update_buffer. |
Yep, problem with glMapBuffer is that it isn't supported in WebGL or WebGL2 at all. But it's not so bad with Nuklear, since it has all the required vertex- and index-data in 2 continuous chunks already, check out the Nuklear rendering code in the Oryol Nuklear wrapper, for sokol-gfx it would be similar (Oryol has separate calls for Gfx::UpdateVertices and Gfx::UpdateIndices, these would be 2 calls to sg_update_buffer() in sokol-gfx: PS: also see here for initialization of the "nuklear buffers": https://github.com/floooh/oryol-nuklear/blob/b854097872600ca391ae4f5f2aa8862183630af4/src/NKUI/nkuiWrapper.cc#L37 |
I get an error from nuklear when I replace the GL code with sokol code. This is the error: |
I just got sokol + sokol_app + nuklear to play nicely together on Windows + OGL 3.3. Would you be interested in a PR to the sokol-examples repo? I can clean up a few things first, but would probably need help with some of the rest of it:
|
Yes :)
I can take care of that.
See my comments in the issue thread: #293, maybe we can come up with a solution similar to how I handle input in Dear ImGui without sokol_app.h changes...
That's fine, a self-contained sample makes sense as first step (that's also how I started with the Dear ImGui integration), a next step later could then be to put the Nuklear wrapper code into a sokol_nuklear.h header, similar to the sokol_imgui.h header. |
I just merged a sokol_nuklear.h backend and example, contributed by @wmerrifield :) |
Would be nice to have a nuklear example (instead or over imgui), since nuklear and sokol are C while imgui is C++.
The text was updated successfully, but these errors were encountered: