Re: [PyOpenGL-Users] No valid context
Brought to you by:
mcfletch
From: Ian M. <ia...@ge...> - 2020-04-21 23:38:44
|
On Sun, Apr 19, 2020 at 8:20 AM physkets via PyOpenGL-Users < pyo...@li...> wrote: > Hi! > > I'm trying to use pyGLFW to make a simple coloured quad, but I fail with > the following error message: > > Traceback (most recent call last): File "first.py", line 121, in > <module> gl.glVertexAttribPointer(LOCATION, 2, gl.GL_FLOAT, False, > STRIDE, OFFSET) File > "/usr/lib/python3.8/site-packages/OpenGL/latebind.py", line 63, in > __call__ return self.wrapperFunction( self.baseFunction, *args, **named > ) File "/usr/lib/python3.8/site-packages/OpenGL/GL/VERSION/GL_2_0.py", > line 469, in glVertexAttribPointer contextdata.setValue( key, array ) > File "/usr/lib/python3.8/site-packages/OpenGL/contextdata.py", line 58, in > setValue context = getContext( context ) File > "/usr/lib/python3.8/site-packages/OpenGL/contextdata.py", line 40, in > getContext raise error.Error(OpenGL.error.Error: Attempt to retrieve > context when no valid context > I am attaching the program that gives me that error along with the shaders. > > Am I doing something wrong? > FWIW I can't reproduce the issue here, although I note that line 121 mentioned in the traceback does not correspond to that line in the attached code, so I don't know if the difference matters. Anyway, the code works as I would expect (Win x64 Py3.7.3, PyOpenGL 3.1.5). Offhand, I am surprised that `glVertexAttribPointer(...)` would be the call to fail; there are plenty of other GL calls that should have failed beforehand, if indeed they didn't fail. GLFW creates a context, and it looks like you're setting it as current. If that code does what it looks like, correctly, then the error especially wouldn't make sense. I would suggest to try validating the context, perhaps creating a debug context. What happens if you just try drawing an empty window without the problematic setup code? Also, why did you comment the context creation hints? Ian |