Reputation: 1971
I am trying to use OpenGL
with python. I have Pyton 3.7.4, on a Windows 10 machine.
I downloaded PyOpenGL
and PyOpenGL_accelerate
from .whl
files, and I have downloaded the freeglut.dll
file separately and placed it in the same directory as the script I am running.
My initial scripts is just:
import OpenGL
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
glutInit()
which gives the following error message:
freeglut (foo): fgPlatformInitialize: CreateDC failed, Screen size info may be i ncorrect This is quite likely caused by a bad '-display' parameter
(Without the freeglut.dll
file, it gives a NameError
complaint about glutInit()
being undefined).
I have seen error on this question but a) they were doing it with C/C++ and b) the answer did not say where one had to make the change.
Any ideas on what I am supposed to do?
UPDATE
The problem may be this:
import os
os.getenv('DISPLAY')
# 'needs-to-be-defined'
What should I call this environment variable?
Upvotes: 1
Views: 804
Reputation: 1971
I just added this piece of code at the beginning of my script and it worked:
import os
try:
del os.environ['DISPLAY']
except:
pass
Ideally I would delete the DISPLAY environment variable for all processes but I did not manage.
Upvotes: 1
Reputation: 990
glutInit(["-display","0"]) - as an idea based on :
https://www.opengl.org/resources/libraries/glut/spec3/node10.html
Upvotes: 0