You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using conrod for the GUI in a VST plugin, but I'm having some problems with event handling:
The way the GUI is run in a VST is, one frame at a time.
So I can't use while let Some(event) = gui.window.next() { because that stalls, but when I try to do one frame by doing if let Some(event) = gui.window.next() { it doesn't register input events. So I tried while let Some(event) = gui.window.poll_event() { which seemed like a logical way to do it (only process events that are in the queue right now, don't block to wait for new events at the end of the queue), then I get input events, but no render events so the GUI doesn't render!
So what should I do to handle the GUI one frame at a time / without internal event loop?
Also, I have another question: What exactly does the event loop do behind the scenes (with the value given by window.set_ups())? Is there a way to turn the event loop off?
(This question is also relevant for writing game UIs, where the game should be in control of the loop and the GUI should be drawn over the scene.)
The text was updated successfully, but these errors were encountered:
The way the GUI is run in a VST is, one frame at a time
By this, do you mean the VST's Host indicates when it's ready to draw the VST's frame so that it can synchronise the drawing with it's own rendering loop?
If so, I think you're on the right track with using poll_event, however you might need to create the Render events for conrod yourself, as I'm guessing they are being triggered by the VST's host rather than piston_window (I could be wrong). You can create Render events for conrod manually using this function (the dpi field is the "dots per inch" multiplier for the display, e.g. on regular displays this is 1.0, on retina displays it is 2.0). You'll want to create one of these events and call ui.handle_event(render_event); each time the VST requires rendering a frame.
I'm not sure I can provide much more help without seeing some code though. How does the VST request a frame at a time? Some kind of callback function? Does it provide you a GL context upon which you need to draw?
Also, I have another question: What exactly does the event loop do behind the scenes (with the value given by window.set_ups())? Is there a way to turn the event loop off?
These are better questions for the piston_window or piston repos (this might be related to what you're after?).
I'm using conrod for the GUI in a VST plugin, but I'm having some problems with event handling:
The way the GUI is run in a VST is, one frame at a time.
So I can't use
while let Some(event) = gui.window.next() {
because that stalls, but when I try to do one frame by doingif let Some(event) = gui.window.next() {
it doesn't register input events. So I triedwhile let Some(event) = gui.window.poll_event() {
which seemed like a logical way to do it (only process events that are in the queue right now, don't block to wait for new events at the end of the queue), then I get input events, but no render events so the GUI doesn't render!So what should I do to handle the GUI one frame at a time / without internal event loop?
Also, I have another question: What exactly does the event loop do behind the scenes (with the value given by window.set_ups())? Is there a way to turn the event loop off?
(This question is also relevant for writing game UIs, where the game should be in control of the loop and the GUI should be drawn over the scene.)
The text was updated successfully, but these errors were encountered: