Skip to content
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

Pass user data in ImDrawData #1309

Closed
n00bmind opened this issue Sep 1, 2017 · 5 comments
Closed

Pass user data in ImDrawData #1309

n00bmind opened this issue Sep 1, 2017 · 5 comments

Comments

@n00bmind
Copy link

n00bmind commented Sep 1, 2017

Hi.
I've just started integrating your awesome library in my engine, but I'm going the pure manual route, so just OpenGL with no wrappers/helper libs.
I use a struct to hold some OpenGL related state, like compiled shader ids, etc, and I find I need to have access to it when my render callback is called, in order to get to this kind of data during rendering.
Since you already group all the data passed to the callback in a nice struct, I think it would be super useful to add a user-configurable void * there so that the callback can get any extra data needed.
Just a suggestion.

Also, I saw you don't have a pure Win32 example, so maybe I could upload a stripped-down version of my code when I manage to integrate the basic stuff, at least as a starting point?

@ocornut
Copy link
Owner

ocornut commented Sep 1, 2017 via email

@ocornut
Copy link
Owner

ocornut commented Sep 1, 2017

@n00bmind Edited my post above for clarity, it was terribly written, sorry for that. (note for self: avoid using phone to reply after landing from a long flight).

I think I will rework the examples to use this approach soon.

@n00bmind
Copy link
Author

Hey,
I just realized that I never got back to you on this..
I got aside a couple hours yesterday and stripped down my code to create a barebones example which I've commited to a fork I created.
I also went ahead and created a pull request #1553, so you can review it and see if you like it.

Cheers, and happy new year!

@ocornut
Copy link
Owner

ocornut commented Jan 14, 2018

Hello!

While I appreciate (and we can use) the work in #1553, I don't see the connection with the question asked at the top of this topic here. My answer was that you can/should ignore the io.RenderDrawListsFn field. You can call Render+GetDrawData and then pass that draw data however you want to your own functions, and that answers your issue above, there's no callback involved anymore, pass around anything you want.

I will rework the examples/ apps to stop using io.RenderDrawListsFn at some point.

Omar

@n00bmind
Copy link
Author

Yes sorry, it's just that I saw this issue linked on my github the other day and then I remembered about the example code..
This should probably be closed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants