如何在Windows上的Anaconda上安装GLUT?

时间:2017-10-17 18:05:09

标签: windows python-3.x opengl anaconda glut

我试图运行一个简单的OpenGL代码:

    override func viewDidLoad() {
    super.viewDidLoad()

    tableView.dataSource = self
    tableView.delegate = self

    recipes = createRecipe()
    getRecipes()
}

但每当我尝试执行它时,我都会收到此错误:

from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *

window = 0                                             # glut window number
width, height = 500, 400                               # window size

def draw():                                            # ondraw is called all the time
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # clear the screen
    glLoadIdentity()                                   # reset position

    # ToDo draw rectangle

    glutSwapBuffers()                                  # important for double buffering


# initialization
glutInit()                                             # initialize glut
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH)
glutInitWindowSize(width, height)                      # set window size
glutInitWindowPosition(0, 0)                           # set window position
window = glutCreateWindow("noobtuts.com")              # create window with title
glutDisplayFunc(draw)                                  # set draw function callback
glutIdleFunc(draw)                                     # draw all the time
glutMainLoop()     

根据this question问题是,OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit, check for bool(glutInit) before calling glut.dll不属于glut32.dll包。所以我下载了dll文件并将它们复制到PyOpenGL并将该文件夹添加到C:/Windows/SysWOW64,但错误仍然存​​在。在上面的相同问题参考中,一个用户还建议将dll文件复制到PATH文件夹。

我在哪里可以在Ananconda安装中找到此文件夹?或者我应该在哪里复制dll文件以使其工作?感谢

1 个答案:

答案 0 :(得分:0)

Rabbid76的回答解决了这个问题:

"当我在Windows系统上安装OpenGL时,我按照this说明并从here"

下载了二进制文件(.whl)