Comments (8)
I just merged a sokol_nuklear.h backend and example, contributed by @wmerrifield :)
from sokol.
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
from sokol.
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.
from sokol.
Would you be interested in a PR to the sokol-examples repo?
Yes :)
I haven't implemented anything but windows OGL 3.3. I also don't really have a mac handy to test out metal, though I could probably handle most of the other renders easily enough.
I can take care of that.
Input is a bit funky since the design of Nuklear
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...
I didn't try to pull the nuklear or sokol boilerplate
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.
from sokol.
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.
from sokol.
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
from sokol.
I get an error from nuklear when I replace the GL code with sokol code. This is the error: Assertion failed: (list->cmd_count), function nk_draw_list_command_last, file ./nuklear.h, line 9291.
, and the code's here: https://github.com/sherjilozair/nuklear-sokol. Run make
and then bin/demo
for the repro. Most of the changes are in nk_glfw3_device_create
and nk_glfw3_render
in the file nuklear_glfw_gl3.h
. Do you perhaps see any mistakes I'm making?
from sokol.
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:
- I didn't set things up to use fips properly, or quite fit in perfectly with the sample app template system. I can probably handle this.
- I haven't implemented anything but windows OGL 3.3. I also don't really have a mac handy to test out metal, though I could probably handle most of the other renders easily enough. I could probably copy-pasta-modify the imgui version of the metal shaders, but not test them.
- Input is a bit funky since the design of Nuklear seems to need a callback before and after the event queue iterator is pumped, whereas sokol_app seems to not really provide callbacks at those times. I can easily "get it working" with a few global variables to aggregate the most recent event state, and some care to deal with swapping app focus, but maybe you have a better idea. See: #293
- I didn't try to pull the nuklear or sokol boilerplate out into a separate file, the way it seems to be for the sokol imgui sample apps. I also don't think I'm fully in the headspace of the project to do that extraction, so I'd probably need help with that part.
from sokol.
Related Issues (20)
- Using Sokol_gfx with multiple CAMetalLayers HOT 5
- sokol_app.h: support sapp_toggle_fullscreen with HTML5 HOT 2
- Triple buffering for metal - sokol_gfx.h HOT 1
- set metal resource labels - sokol_gfx.h HOT 5
- What is the best way to add tessellation shader support for OpenGL backend? HOT 2
- Rendering to different default gl framebuffers - sokol_gfx.h
- Compressed data & chunk size fails fetch HOT 7
- Some way to sponsor the project in the readme HOT 1
- Question: Where are mipmaps generated? HOT 2
- The allocator callbacks should not be called alloc/free. HOT 1
- Towards a unified sg_begin_pass()
- sg_make_image crash when Xcode Metal API Validation enabled HOT 7
- sg_begin_default_pass on metal sometimes costs 10+ms HOT 7
- Unify the various _cb, _func, _fn suffixes
- sokol_gfx.h: cubemap filtering is not seamless on GLCORE33 backend HOT 6
- Mipmap sampling of non-square image results in black texture on GL/GLES HOT 4
- Reminder: investigate live object report on D3D11
- sokol_gfx failing to compile on macOS 12.4 with `use of undeclared identifier 'MTLGPUFamilyApple8'` HOT 10
- How to sync graphics with audio? HOT 2
- Misleading error message VALIDATE_ABND_FS_EXPECTED_IMAGE_BINDING HOT 3
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 sokol.