如何使用 Arcade 库修复 MissingFunctionException

How to fix a MissingFunctionException with Arcade library

我正在练习 Arcade 库 2D 游戏开发。但是我的第一个程序以错误结束!

我想在 Python 中使用易于学习的 街机库 制作我的第一款 2D 游戏- 快乐的笑脸 - .

import arcade

# set constants for the screen size:
SCREEN_WIDTH = 600
SCREEN_HEIGHT = 600

# open the window, set screen size & dimension:
arcade.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, "Hello, World! [Smiley]")

# set the bgcolor to white:
arcade.set_background_color(arcade.color.WHITE)

# start the render process, this must done before any drawing commands:
arcade.start_render()

# draw the face:
x, y, r = 300, 300, 200
arcade.draw_circle_filled(x, y, r, arcade.color.YELLOW)

# draw the right eye:
x = 370
y = 350
r = 20
arcade.draw_circle_filled(x, y, r, arcade.color.BLACK)

# draw the left eye:
x = 230
y = 350
r = 20
arcade.draw_circle_filled(x, y, r, arcade.color.BLACK)

# draw the smile:
x = 300
y = 280
width = 120
height = 100
start_angle = 190
end_angle = 350
arcade.draw_arc_outline(x, y, width, height, arcade.color.BLACK, start_angle, end_angle)

# finish drawing and display the result:
arcade.finish_render()

# keep the window open until the user hits the 'close' button:
arcade.run()

我期待 'Yellow Emoji with a smile'。但是我遇到了 意外错误:

Start
Start
Traceback (most recent call last):
  File "E:/Python/#Programs/arcade_pract/Hello, arcade!.py", line 18, in <module>
    arcade.draw_circle_filled(x, y, r, arcade.color.YELLOW)
  File "C:\Users\AVD\AppData\Roaming\Python\Python37\site-packages\arcade\draw_commands.py", line 629, in draw_circle_filled
    draw_ellipse_filled(center_x, center_y, width, height, color, num_segments=num_segments)
  File "C:\Users\AVD\AppData\Roaming\Python\Python37\site-packages\arcade\draw_commands.py", line 696, in draw_ellipse_filled
    _generic_draw_line_strip(point_list, color, gl.GL_TRIANGLE_FAN)
  File "C:\Users\AVD\AppData\Roaming\Python\Python37\site-packages\arcade\draw_commands.py", line 795, in _generic_draw_line_strip
    fragment_shader=line_fragment_shader,
  File "C:\Users\AVD\AppData\Roaming\Python\Python37\site-packages\arcade\shader.py", line 226, in program
    (fragment_shader, GL_FRAGMENT_SHADER)
  File "C:\Users\AVD\AppData\Roaming\Python\Python37\site-packages\arcade\shader.py", line 111, in __init__
    self.prog_id = prog_id = glCreateProgram()
  File "C:\Users\AVD\AppData\Roaming\Python\Python37\site-packages\pyglet\gl\lib_wgl.py", line 107, in __call__
    return self.func(*args, **kwargs)
  File "C:\Users\AVD\AppData\Roaming\Python\Python37\site-packages\pyglet\gl\lib.py", line 64, in MissingFunction
    raise MissingFunctionException(name, requires, suggestions)
pyglet.gl.lib.MissingFunctionException: glCreateProgram is not exported by the available OpenGL driver.  VERSION_2_0 is required for this functionality.
Warning: Anti-aliasing not supported on this computer.

所以,我找到了。 我没有 Dedicated Graphics 卡,我的内置 Intel 显卡不支持 抗锯齿