I can't run even the simplest program that is using OpenGL / GLUT.
i.e.
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
def showScreen():
# Remove everything from screen (i.e. displays all white)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
glutInit() # Initialize a glut instance which will allow us to customize our window
glutInitDisplayMode(GLUT_RGBA) # Set the display mode to be colored
glutInitWindowSize(500, 500) # Set the width and height of your window
# Set the position at which this windows should appear
glutInitWindowPosition(0, 0)
wind = glutCreateWindow("OpenGL Coding Practice") # Give your window a title
# Tell OpenGL to call the showScreen method continuously
glutDisplayFunc(showScreen)
# Draw any graphics or shapes in the showScreen function at all times
glutIdleFunc(showScreen)
glutMainLoop()
I always receive this error message:
Traceback (most recent call last):
File "/Users/xyz/jebacglut123.py", line 11, in <module>
glutInit() # Initialize a glut instance which will allow us to customize our window
File "/usr/local/anaconda3/envs/opengl/lib/python3.8/site-packages/OpenGL/GLUT/special.py", line 362, in glutInit
_base_glutInit(ctypes.byref(count), holder)
File "/usr/local/anaconda3/envs/opengl/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 423, in __call__
raise error.NullFunctionError(
OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit, check for bool(glutInit) before calling
I'm using MacOS Big Sur 20B29, python 3.8.5 and PyOpenGL 3.1.5. I have modified the PyOpenGL file using this tutorial to fix other error.