Download the necessary files:
Install PyOpenGL by running the following command on the command prompt with administrative privileges:
pip install PyOpenGL
Extract the downloaded freeglut runtime binary files to a folder.
Copy the freeglut.dll file from the bin folder to the Python36 folder:
C:\Python36
Copy the glut.dll and glut32.dll files from the bin folder to the Windows System32 folder:
C:\Windows\System32
To test the installation, run this Python code:
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
def draw():
glClear(GL_COLOR_BUFFER_BIT)
glutSolidTeapot(0.5)
glFlush()
glutInit()
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)
glutInitWindowSize(250, 250)
glutInitWindowPosition(100, 100)
glutCreateWindow(b"Teapot")
glutDisplayFunc(draw)
glClearColor(0.0,1.0,0.0,0.0)
gluOrtho2D(-1.0,1.0,-1.0,1.0)
glutMainLoop()
This should open a window with a teapot. If it works correctly, then the installation was successful.
Asked: 2023-07-10 22:57:44 +0000
Seen: 9 times
Last updated: Jul 10 '23