Comments (3)
Hey and thanks for the issue,
Would it be possible to append a zr_handle user_data to struct zr_context, struct zr_draw_command and struct zr_command. The handling could be similar to zr_set_font.
Do you mean same the userdata for zr_context
, zr_draw_command
and zr_command
or each having their own? Other than that I don't see a problem of adding it per se but it will blow up the memory consumption for zr_command
and to some extend in zr_draw_command
as well. So if I will add userdata to zr_command
and zr_draw_command
I will also add defines to make sure not everyone has to pay for the additional costs.
But can I ask for what this is needed? I thought I made everything abstract enough so that you only need the zr_context
struct to draw everything?
from nuklear.
or each having their own?
No, no, one for them all would be enough, just like setting a font.
But can I ask for what this is needed?
Imagine one wants to draw a bunch of buttons each using a different shader:
for (i = buttonCount; i > 0; i -= 1) {
zr_set_userdata(context, (zr_handle)shader_for_button(i));
do_button(i);
zr_set_userdata(context, (zr_handle)default_shader);
do_decoration(...);
}
And in the draw loop:
zr_draw_foreach(cmd, context, &cmds) {
shader = (shader_id)cmd->user_data;
bind_shader(shader);
draw_elements(...);
...
}
I will also add defines to make sure not everyone
That would be perfect!
from nuklear.
I actually think it's worth adding, because tracking the data outside of the draw list would be too cumbersome. So I agree with making it conditional and adding it's use into demos.
from nuklear.
Related Issues (20)
- Documentation link to the rawgit.com is Supposed to stop Working in 2019_10 HOT 3
- Change the whole library to not use any null-terminated strings HOT 6
- Layouting using groups HOT 14
- Internal drawing bug HOT 2
- Nuklear render on hooked d3d9 app breaks when app displays a tooltip
- (Question) images in nuklear HOT 2
- NK_EDIT_GOTO_END_ON_ACTIVATE not working with nk_edit_string_zero_terminated
- Examples won't compile on macOS because it doesn't have pkg-config by default. HOT 1
- Rendering to a framebuffer instead of OpenGL HOT 10
- GLFW adapter not drawing Properly HOT 1
- combined character displaying each as different character
- Image created in memory triggers "if this triggers you forgot to add a font" HOT 1
- When I update the nk_begin title it blocks the entire window.
- Get rid of scissors?
- the GDI+ version make the nk_button_color draw the rectangle with inner black lines
- Suggestion: Center docs
- Option for component shadow
- Segmentation failed to try nk_style_set_font in the glfw_opengl3 demo HOT 1
- How to know if a edit_string is active or not ? HOT 1
- ALL DEVELOPMENT MOVED ELSEWHERE
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 nuklear.