doushuo8677 2019-08-25 07:13
浏览 527
已采纳

如何安装opengl使其运行

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

// from: https://github.com/fyne-io/fyne
package main
import (
    "fyne.io/fyne/widget"
    "fyne.io/fyne/app"
)
func main() {
    app := app.New()
    w := app.NewWindow("Hello")
    w.SetContent(widget.NewVBox(
        widget.NewLabel("Hello Fyne!"),
        widget.NewButton("Quit", func() {
            app.Quit()
        }),
    ))
    w.ShowAndRun()
}

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

I:\>rnfynetest
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/fyne.io/fyne/internal/driver/gl/window.go:1007
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x2c pc=0x572afd]

goroutine 1 [running, locked to thread]:
fyne.io/fyne/internal/driver/gl.(*window).SetContent(0x0, 0x8fc5e0, 0x1386e0c0)
        C:/Users/ABCD/go/src/fyne.io/fyne/internal/driver/gl/window.go:361 +0x1d
main.main()
        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 github.com/go-gl/gl/v{3.2,3.3,4.1,4.2,4.3,4.4,4.5,4.6}-{core,compatibility}/gl
go get -u github.com/go-gl/gl/v3.1/gles2
go get -u github.com/go-gl/gl/v2.1/gl

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.

Edit:

I tried following commands:

go get -u github.com/go-gl/gl/v2.1/gl
go get -u github.com/go-gl/gl/v4.6-core/gl
go get -u github.com/go-gl/gl/v4.6-compatibility/gl

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 github.com/go-gl/gl/v3.1/gles2
# github.com/go-gl/gl/v3.1/gles2
C:\Users\ABCD\go\src\github.com\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.
  • 写回答

1条回答 默认 最新

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥20 ROS中的TEB局部规划问题
      • ¥20 关于#matlab#的问题:要求测出上面图片中所有同心圆的半径
      • ¥20 epanet软件运行问题
      • ¥15 Python 文件读取
      • ¥60 dpabi进行Alff计算时脑池有干扰信号
      • ¥15 利用kmeans或kshape聚类分析对归一化的无量纲时间-降雨序列进行聚类
      • ¥15 protel99.SE提示一下弹窗
      • ¥15 银河麒麟v10 执行.run失败如何解决
      • ¥15 如何用Python打开LA文件
      • ¥15 用mysql做一个酒店管理系统