Re: No valid context
Ian Mallett <[email protected]> Tue, 21 Apr 2020 17:38:24 -0600
| Newsgroups | gmane.comp.python.opengl.user |
|---|---|
| Message-ID | <CAG4NV=uOxq4AyrRAZYvFatnZKMpq9uLLdjXcTn0dMqcWGHvxjg@mail.gmail.com> |
--===============7135657991727133061== Content-Type: multipart/alternative; boundary="000000000000a6898505a3d58348" --000000000000a6898505a3d58348 Content-Type: text/plain; charset="UTF-8" On Sun, Apr 19, 2020 at 8:20 AM physkets via PyOpenGL-Users < [email protected]> 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 --000000000000a6898505a3d58348 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr">On Sun, Apr 19, 2020 at 8:20 AM physkets = via PyOpenGL-Users <<a href=3D"mailto:[email protected]= et">[email protected]</a>> wrote:<br></div><div class= =3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px = 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi!<br> <br> I'm trying to use pyGLFW to make a simple coloured quad, but I fail wit= h the following error message:<br> <br> Traceback (most recent call last):=C2=A0 File "first.py", line 12= 1, in <module>=C2=A0 =C2=A0 gl.glVertexAttribPointer(LOCATION, 2, gl.= GL_FLOAT, False, STRIDE, OFFSET)=C2=A0 File "/usr/lib/python3.8/site-p= ackages/OpenGL/latebind.py", line 63, in __call__=C2=A0 =C2=A0 return = self.wrapperFunction( self.baseFunction, *args, **named )=C2=A0 File "= /usr/lib/python3.8/site-packages/OpenGL/GL/VERSION/GL_2_0.py", line 46= 9, in glVertexAttribPointer=C2=A0 =C2=A0 contextdata.setValue( key, array )= =C2=A0 File "/usr/lib/python3.8/site-packages/OpenGL/contextdata.py&qu= ot;, line 58, in setValue=C2=A0 =C2=A0 context =3D getContext( context )=C2= =A0 File "/usr/lib/python3.8/site-packages/OpenGL/contextdata.py"= , line 40, in getContext=C2=A0 =C2=A0 raise error.Error(OpenGL.error.Error:= Attempt to retrieve context when no valid context<br> I am attaching the program that gives me that error along with the shaders.= <br> <br> Am I doing something wrong?<br></blockquote><div><br></div><div>FWIW I can&= #39;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 d= on't know if the difference matters. Anyway, the code works as I would = expect (Win x64 Py3.7.3, PyOpenGL 3.1.5).</div><div><br></div><div>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, correc= tly, then the error especially wouldn't make sense. I would suggest to = try validating the context, perhaps creating a debug context.</div><div><br= ></div><div>What happens if you just try drawing an empty window without th= e problematic setup code? Also, why did you comment the context creation hi= nts?<br></div><div><br></div><div>Ian<br></div></div></div> --000000000000a6898505a3d58348-- --===============7135657991727133061== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============7135657991727133061== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ PyOpenGL Homepage http://pyopengl.sourceforge.net _______________________________________________ PyOpenGL-Users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyopengl-users --===============7135657991727133061==--