2019-08-25 07:13


  • user-interface
  • opengl

I am trying following simple code to create a GUI using Fyne package:

// from:
package main
import (
func main() {
    app := app.New()
    w := app.NewWindow("Hello")
        widget.NewLabel("Hello Fyne!"),
        widget.NewButton("Quit", func() {

It compiles and builds executable file without any error or even warning, but on trying to run it gives following error:

2019/08/25 12:37:18 Fyne error:  failed to initialise OpenGL
2019/08/25 12:37:18   Cause: glBeginConditionalRender
2019/08/25 12:37:18   At: C:/Users/ABCD/go/src/
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x2c pc=0x572afd]

goroutine 1 [running, locked to thread]:*window).SetContent(0x0, 0x8fc5e0, 0x1386e0c0)
        C:/Users/ABCD/go/src/ +0x1d
        I:/rnfynetest.go:10 +0x1ce

As given on Fyne homepage I need to install OpenGL. From go bindings for OpenGL it seems there are three ways to install it:

go get -u{3.2,3.3,4.1,4.2,4.3,4.4,4.5,4.6}-{core,compatibility}/gl
go get -u
go get -u

Which of these commands do I need to use? I am working on Windows7 and using go version go1.12.9 windows/386

Thanks for your help.


I tried following commands:

go get -u
go get -u
go get -u

They all install all right but same error is persisting on trying to run built executable.

I also tried gles2 but it does not install rather gives following error:

I:\>go get -u
C:\Users\ABCD\go\src\\go-gl\gl\v3.1\gles2\package.go:38:11: fatal error: KHR/khrplatform.h: No such file or directory
 // #include <KHR/khrplatform.h>
compilation terminated.
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • douxi8119 douxi8119 2年前

    The OpenGL libraries typically come from your graphics card drivers, and looks like Fyne-io needs fairly new Graphics Card Drivers. (It uses OpenGL 3.2 which was released around 2009 It uses OpenGL 2.0). So you can try to:


    • Update your Graphics Card drivers - If they are available for your hardware, to get GPU accelerated OpenGL. Definitely try this this if you are planning on making a graphics intensive application).

    Edit: Updated the version of the OpenGL context Fyne uses

    点赞 评论 复制链接分享