[ANN] Renderview v0.1.0 with go mod, Gio, and Fyne support

326 views
Skip to first unread message

howar...@gmail.com

unread,
Feb 21, 2020, 11:00:33 PM2/21/20
to golang-nuts
Four years ago I posted Renderview, a simple GUI wrapper that lets you take any image generation function in your code and turn it into an interactive GUI program with panning, optional zooming, and depending on backend choice, parameter editing.


I have updated it to support go modules, and added support for the recently appearing Gio and Fyne GUI toolkits. They are both operational, if a bit oddly. I tested Gio on Windows yesterday when I had a chance, and it did build, but for some reason, did not respond to mouse movements, only mouse scrolling, and I have not resolved that issue yet.

So now, in addition to serving as a quick and dirty tool for exercising your image generating or algorithm visualizing code, the code-base itself serves as a comparative implementation of the same task in Shiny,  go-gtk, GoTK3, Gio, and Fyne.

I did attempt implementations in a few other environments with no success - I need some path to go from an image.Image to a displayed image onscreen, and could not find a mechanism to do this in a few of the libraries. (Granted, I didn't find a way to do it in go-gtk or GoTK3 either - I brute forced it since they at least gave access to the memory backing an onscreen image. So the source also provides an example of converting from an image.RGBA and an image.NRGBA to the internal format of GTK images.)

I still need to go back through and fix-up the interactions to remove data races, but they don't seem to have affected the performance or behavior so far.

Howard C. Shaw III

Kt Ye

unread,
Feb 22, 2020, 3:12:41 AM2/22/20
to golang-nuts
For Windows, this will draw an image on screen: https://play.golang.org/p/-KDo9pHXZCj without external dependencies.
It's non-interactive, but nice to just see an image.

It comes in two versions: dev=SCREEN draws over the primary monitor, over everything else without borders. The image disappears when others redraw.
The other option is dev=CONSOLE which draws over the active console (the cmd.exe window) in a command line session. It even scrolls when new text appears.

howar...@gmail.com

unread,
Feb 22, 2020, 10:32:02 AM2/22/20
to golang-nuts
As far as Windows goes, the Shiny backend works fine to draw a pannable, zoomable image with Renderview on Windows, and as far as I am aware, requires no further dependencies. But there is still not an editable text widget in Shiny, and while I was able to find a third-party multi-line text editor, I was not able to find a single-line one suitable for using as a generic data entry field. 

So currently only the other four backends support editable widgets on Windows. They all require additional work on Windows to operate, however. For example, with Gio, I had to download a set of .DLL files and extract them into the root folder of my Go build, as documented on the Gio website.

Meanwhile Fyne appears to require installation of a C compiler on Windows, go-gtk and gotk3 need a working GTK environment, etc.

Howard

Elias Naur

unread,
Feb 24, 2020, 3:36:08 AM2/24/20
to golang-nuts


On Saturday, February 22, 2020 at 5:00:33 AM UTC+1, howar...@gmail.com wrote:

I have updated it to support go modules, and added support for the recently appearing Gio and Fyne GUI toolkits. They are both operational, if a bit oddly. I tested Gio on Windows yesterday when I had a chance, and it did build, but for some reason, did not respond to mouse movements, only mouse scrolling, and I have not resolved that issue yet.


I would love to figure out what causes the missing mouse events on Windows. To not derail this thread, please do file an issue on gioui.org/issue/, join #gioui on the gophers.slack.com channel, or write me directly at ma...@eliasnaur.com.

FWIW, I ran the renderview/cmd/cmdgui program on Windows 10 which showed me a bunch of editable fields, all clickable.
 
So now, in addition to serving as a quick and dirty tool for exercising your image generating or algorithm visualizing code, the code-base itself serves as a comparative implementation of the same task in Shiny,  go-gtk, GoTK3, Gio, and Fyne.


Nice.
 
As far as Windows goes, the Shiny backend works fine to draw a pannable, zoomable image with Renderview on Windows, and as far as I am aware, requires no further dependencies. But there is still not an editable text widget in Shiny, and while I was able to find a third-party multi-line text editor, I was not able to find a single-line one suitable for using as a generic data entry field.

Have you seen https://github.com/aarzilli/nucular? I believe it has a Shiny backend.

For example, with Gio, I had to download a set of .DLL files and extract them into the root folder of my Go build, as documented on the Gio website.

I happen to be working on a direct3d port of Gio which I hope to have ready within this week, in which case the 3 opengl DLLs are no longer needed. You can follow the work at https://git.sr.ht/~eliasnaur/gio/log/d3d11.

-- elias

howar...@gmail.com

unread,
Feb 25, 2020, 6:21:47 PM2/25/20
to golang-nuts
I worked it out, will update the programs later. It was not that the events were missing - once I enabled the good old Printf debugger, I saw that the events are flowing fine. The issue is that on Linux, every Move Mouse event reflected what buttons were pressed the entire time they were pressed. On Windows, only the Press Mouse event included a value for the Button that was pressed (i.e. pointer.ButtonLeft).  

mouse pos({Move Mouse 0 Shared 863h55m54.282s  false {637 369} {0 0} }) false
mouse pos({Press Mouse 0 Shared 863h55m54.425s ButtonLeft false {637 369} {0 0} }) true
mouse down left({Press Mouse 0 Shared 863h55m54.425s ButtonLeft false {637 369} {0 0} })
mouse pos({Move Mouse 0 Shared 863h55m54.515s  false {638 369} {0 0} }) false
mouse pos({Move Mouse 0 Shared 863h55m54.535s  false {639 369} {0 0} }) false
mouse pos({Move Mouse 0 Shared 863h55m54.555s  false {642 369} {0 0} }) false
Dragging.
mouse pos({Move Mouse 0 Shared 863h55m54.572s  false {645 370} {0 0} }) false
mouse pos({Move Mouse 0 Shared 863h55m54.59s  false {648 370} {0 0} }) false

My code was detecting the return to 0 as the mouse button no longer being pressed.

Howard

Elias Naur

unread,
Feb 26, 2020, 4:58:52 AM2/26/20
to howar...@gmail.com, golang-nuts
On Tue Feb 25, 2020 at 3:21 PM, wrote:
> I worked it out, will update the programs later. It was not that the
> events
> were missing - once I enabled the good old Printf debugger, I saw that
> the
> events are flowing fine. The issue is that on Linux, every Move Mouse
> event
> reflected what buttons were pressed the entire time they were pressed.
> On
> Windows, only the Press Mouse event included a value for the Button that
> was pressed (i.e. pointer.ButtonLeft).
>

That's a bug, now fixed with

https://git.sr.ht/~eliasnaur/gio/commit/e3f8d1a1afb27213f5e4c2e0b161e76d69778ff3

Thanks for finding it!

-- elias

Elias Naur

unread,
Feb 27, 2020, 4:51:02 PM2/27/20
to golang-nuts
On Mon, Feb 24, 2020 at 9:36 AM Elias Naur <ma...@eliasnaur.com> wrote:

>> For example, with Gio, I had to download a set of .DLL files and extract them into the root folder of my Go build, as documented on the Gio website.
>
>
> I happen to be working on a direct3d port of Gio which I hope to have ready within this week, in which case the 3 opengl DLLs are no longer needed. You can follow the work at https://git.sr.ht/~eliasnaur/gio/log/d3d11.
>

Direct3D is now done, which should eliminate the dependency on OpenGL
emulation DLLs.

-- elias
Reply all
Reply to author
Forward
0 new messages