在虚拟机(VMware、Azure)上添加OpenGL支持以运行Go Fyne应用程序。

huangapple go评论85阅读模式
英文:

Adding opengl support on vm(vmware,azure) to run Go Fyne app

问题

我正在尝试在虚拟机上运行一个 Fyne 应用程序。我已经在 VirtualBox 和 Azure 上尝试过了。在运行应用程序后,我遇到了以下错误:

原因:APIUnavailable: WGL:驱动程序似乎不支持 OpenGL
位置:fyne.io/fyne/v2@v2.2.3/internal/driver/glfw/driver.go:148

我在虚拟机中通过启用3D 加速来解决了这个问题。但是在 Azure 上我无法做到同样的操作。

其中一个选择是选择支持 GPU 的模板。有一些特殊的 VM 系列,比如 N 系列 VM,支持 GPU。但是为了运行一个 Fyne 应用程序,我不想支付 GPU VM 的费用。

另一个选择是使用 GPU 透传功能。但是我找不到任何关于如何做到这一点的文档。

是否有其他解决方法?

英文:

I am trying to run a Fyne app on a VM. I have attempted it on VirtualBox and Azure. After running the app, I get the following error:

  Cause:APIUnavailable: WGL: The driver does not appear to support OpenGL
  At: fyne.io/fyne/v2@v2.2.3/internal/driver/glfw/driver.go:148

在虚拟机(VMware、Azure)上添加OpenGL支持以运行Go Fyne应用程序。

I was able to solve this in VM by enabling 3D acceleration. But I am not able to do the same in Azure.

在虚拟机(VMware、Azure)上添加OpenGL支持以运行Go Fyne应用程序。

One option is to select the template which supports GPU. There are special VM series like the N-series VMs which support GPU. But just to run a Fyne app, I don't want to pay for a GPU VM.

Another option is to use the GPU pass-through feature. But I am not able to find any documentation on how to do this.

Is there any other way to solve this?

答案1

得分: 0

在桌面屏幕上运行Fyne应用程序需要OpenGL,这是不可避免的。正如你所发现的,大多数虚拟机将其称为"3D加速"。如果没有这种支持,它将无法绘制到窗口中。

英文:

Running a Fyne app on a desktop screen requires OpenGL, this is unavoidable. As you have found most VMs call this “3D acceleration”.
Without this support it cannot draw to the window.

答案2

得分: 0

  1. 这里下载opengl32.dll文件,在“解决方案2:如果您使用的是Windows 7/8”下面。

  2. 转到C:\Windows\System32,找到opengl32.dll,右键单击,选择属性 -> 安全 -> 高级,将打开一个新窗口。

  3. 选择更改,将打开一个新窗口。在“输入要选择的对象名称”部分,输入用户名(Sanjay)并检查名称

注意:如果未更改属性,您将收到“您需要来自trustedinstaller的权限”的错误。

  1. 现在备份原始的dll文件,并用下载的文件替换它。

  2. 现在只需启动“Fyne”应用程序,它将正常工作。

英文:
  1. Download the opengl32.dll file from here, under "Solution 2: If you're on Windows 7/8"

  2. Go to C:\Windows\System32 and find opengl32.dll, right click and go to properties -> security -> Advanced, a new window will open

  3. Select change, a new window will open. In the Enter the object name to select section, enter the user name (Sanjay) and check names

  • Follow the Blog or Video to change the properties of the dll file

    Note: If properties are not changed you will get the "you require permission from trustedinstaller" error

  1. Now backup the original dll file and replace it with the downloaded one.

  2. Now Simply start the "Fyne" app and it will work

huangapple
  • 本文由 发表于 2022年10月30日 17:54:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/74252049.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定