christolliday / limn

Experimental cross platform GUI library
Other
404 stars 19 forks source link

Add support for displaying OpenGL textures (for making GL canvas apps) #16

Closed valpackett closed 6 years ago

valpackett commented 6 years ago

Like this demo (included here):

screen_2017-10-08-02 33 28

(My first time doing anything with OpenGL… Thanks for an excuse to finally play with it :D)

christolliday commented 6 years ago

Awesome work! Will be nice to have an example that demos drawing to an image buffer, especially one that looks so good. Going to take some more time to look it over, but looks pretty good so far.

christolliday commented 6 years ago

Just added a commit that replaces your tick callback with an event FrameEvent. In general this is the model I've been following for any kind of callback. Using event handlers everywhere does have some drawbacks but my hope is it makes it easier to learn the API and allows a simpler implementation. Any issues you see using it here (or in general)?

It should also resolve an issue I found where sometimes the animation would stop, which it turned out was because it depended on the webrender RenderNotifier waking up the event loop in response to a new frame, which will not always happen at the right time in the event loop for it to not wait. For as long as a FrameEvent triggers a redraw, it should always redraw after that, then send another FrameEvent.

valpackett commented 6 years ago

Wait, you can push to my fork?! o_0 That's… a very WTF GitHub feature.

Anyway, I've tried using an event first, that's why add_handler_fn_mut was in the patch but not used in the example. Something didn't work out there for some reason, so I made a special callback that's called in the right place. Your fix works fine though :)

christolliday commented 6 years ago

hah yeah sorry if pushing to your master branch threw you off, was going to make a separate branch and PR to add that commit but thought I'd keep the discussion in one place, then surprisingly github let me ;)

christolliday commented 6 years ago

Awesome, thanks!