2017-10-17 9 views
0

Je suis en train d'exécuter un simple code OpenGL:Comment installer GLUT sur Anaconda sous Windows?

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()  

Mais chaque fois que j'essayer de l'exécuter je reçois cette erreur:

OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit, 
check for bool(glutInit) before calling 

Selon this question Le problème est que le glut.dll et glut32.dll ne font pas partie du package PyOpenGL. J'ai donc téléchargé les fichiers dll et les copiés à C:/Windows/SysWOW64 et ajouté ce dossier à PATH, mais l'erreur persiste. Dans la même référence de question ci-dessus, un utilisateur suggère également de copier les fichiers dll dans le dossier Python OpenGL DLL.

Où puis-je trouver ce dossier dans mon installation Ananconda? Ou où dois-je copier les fichiers dll pour faire ce travail? Merci

+0

Quand j'ai installé OpenGL sur mon Windows système, je suis [** ce **] (https://codeyarns.com/2012/04/27/pyopengl-installation-notes-for-windows/) instructions et j'ai téléchargé les binaires (* .whl *) de [ ** ici **] (http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopengl) – Rabbid76

+1

@ Rabbid76 Cela a fonctionné. Merci. –

Répondre

0

Réponse Rabbid76 a résolu le problème:

« Quand j'ai installé OpenGL sur mon système Windows, je suis this instructions et téléchargé les binaires (.whl) de here »