Kivy没有检测到OpenGL 2.0

2024-05-18 12:24:15 发布

您现在位置:Python中文网/ 问答频道 /正文

我决定在Kivy cross平台上做一些编程,并成功地将Kivy安装到我的计算机上。问题是,当我运行代码时,会出现以下错误:

[INFO              ] [Kivy        ] v1.9.1
[INFO              ] [Python      ] v3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 20:20:57) [MSC v.1600 64 bit (AMD64)]
[INFO              ] [Factory     ] 179 symbols loaded
[INFO              ] [Image       ] Providers: img_tex, img_dds, img_gif, img_sdl2 (img_pil, img_ffpyplayer ignored)
[INFO              ] [OSC         ] using <thread> for socket
[INFO              ] [Window      ] Provider: sdl2
[INFO              ] [GL          ] GLEW initialization succeeded
[INFO              ] [GL          ] OpenGL version <b'1.1.0'>
[INFO              ] [GL          ] OpenGL vendor <b'Microsoft Corporation'>
[INFO              ] [GL          ] OpenGL renderer <b'GDI Generic'>
[INFO              ] [GL          ] OpenGL parsed version: 1, 1
[CRITICAL          ] [GL          ] Minimum required OpenGL version (2.0) NOT found!

OpenGL version detected: 1.1

Version: b'1.1.0'
Vendor: b'Microsoft Corporation'
Renderer: b'GDI Generic'

Try upgrading your graphics drivers and/or your graphics hardware in case of problems.

The application will leave now.

然后弹出这个错误框:

Kivy Fatal Error

我已经通过GPU Caps Viewer检查了我的GPU的OpenGL版本,验证我是否达到OpenGL版本2.1,但是Kivy不知怎么的没有检测到OpenGL 2.1,而是默认为微软的GDI Generic。我在互联网上做了一些研究,发现解决这个问题的最好方法是从你的图形卡制造商那里更新你的图形卡驱动程序,但这在我的情况下不起作用。

我已经更新了我的图形驱动程序(我正在64位Windows 8上运行NVIDIA GeForce GT 435M)。

我的问题是:有没有办法让Kivy从GDI通用驱动程序切换到NVIDIA驱动程序?还是别的地方有问题?


Tags: infoimgyourversion错误驱动程序genericmicrosoft
3条回答

我使用Python3.6和Windows8.1。也适用于Windows 10。
这种解决方案在大多数情况下都能解决问题:
.
一。右键单击这台电脑,然后打开属性 2。转到高级系统设置 三。单击环境变量
四。单击用户变量中的新建
5个。将KIVY_GL_BACKEND放入变量名中
6。将角度sdl2
放入变量值
7号。重新启动Python

以下是YouTube视频,显示了以下步骤: https://www.youtube.com/watch?v=ATK9w2AiDeM

py3.5+的角度后端

pip install kivy.deps.angle 
set KIVY_GL_BACKEND=angle_sdl2

它在windows 10上运行良好,解决了上述问题。多样本在我的情况下不起作用

在windows7pro32bit上添加Config.set('graphics', 'multisamples', '0')为我解决了这个错误。(更新:这也适用于Windows 10。)

import kivy 
kivy.require('1.9.1') # replace with your current kivy version !

from kivy.app import App
from kivy.uix.label import Label

# add the following 2 lines to solve OpenGL 2.0 bug
from kivy import Config
Config.set('graphics', 'multisamples', '0')


class MyApp(App):

    def build(self):
        return Label(text='Hello world')

if __name__ == '__main__':
    MyApp().run()

更改后,将正确报告OpenGL版本:

[INFO ] [GL ] GLEW initialization succeeded

[INFO ] [GL ] OpenGL version <2.1.0 - Build 8.15.10.2281>

相关问题 更多 >

    热门问题