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

Questions from a newbie #4

Closed
jgarvin opened this issue Jun 19, 2020 · 1 comment
Closed

Questions from a newbie #4

jgarvin opened this issue Jun 19, 2020 · 1 comment

Comments

@jgarvin
Copy link

jgarvin commented Jun 19, 2020

Some of these questions may be straightforward but I've never done in game ui or used imgui, and I'm working on my first rust project, so it's all new to me.

  • I've been reading through the example code try to get a handle on how things work. I see a lot of these sorts of show calls in the example: .show(ui, |ui| self.painting.ui(ui)); Why take the ui object and also a lambda taking a ui object? I started digging to try and see if the ui just gets passed in later but it looks like child ui's are getting passed in?

  • I guess more generally if the rendering isn't immediate mode, is each frame building one big call-list/vertex-buffer/etc from scratch, or is it somehow figuring out what has or hasn't changed between frames and only sending stuff to the gpu that's different?

  • Why is a bunch of the core app state serializable? For example the ExampleApp struct. I noticed state seems to be preserved across refreshes if you only manipulate the Examples window -- but if you open any other window than it resets the whole gui to its original state on refresh -- and there's an every frame call to save_memory, but it looks like ultimately that is is only going to save the Memory struct, so I'm not sure how that would interact with other application state.

@emilk
Copy link
Owner

emilk commented Jun 29, 2020

Why take the ui object and also a lambda taking a ui object?

in most cases the lambda is given a different Ui instance, or some setup/teardown is performed on the Ui before calling the lambda

is each frame building one big call-list/vertex-buffer/etc from scratch

yes

Why is a bunch of the core app state serializable?

the web wasm example stores the state in local storage, and the glium example code stores it in a json file. it is just nice to be able to continue where you left off.

I might switch out serde for nanoserde though.

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