Re: "Attempt to retrieve context when no valid context" when calling glVertexAttribPointer in GL ES 2
JP LeBreton <[email protected]> Tue, 2 Jan 2018 23:44:11 -0600
| Newsgroups | gmane.comp.python.opengl.user |
|---|---|
| Message-ID | <CAEBBUWgyJU+UA=5Yk1v4iQ-sa3iBLSs2dcD2Eb3gKq95QjSd3w@mail.gmail.com> |
--===============0959053762955836152== Content-Type: multipart/alternative; boundary="001a113ed240d13f440561d8b6cc" --001a113ed240d13f440561d8b6cc Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks for the reply. The context does seem to be the window's current one, SDL_GL_MakeCurrent didn't change anything. I'm running it from the Raspbian Pixel desktop and made sure there are no other SDL2 windows nor OpenGL contexts active on the system, just in case that was a factor. Correct, I did have a few local uncommitted changes - as of about 15 minutes ago the current state of the repo should reproduce the error on a Pi 3. PySDL2 and PyOpenGL have been working fine together for this application on x86[_64] Linux, macOS, and Windows, on Intel and Nvidia GPUs, but I realize the Pi is a fairly different environment and drivers play a large role. I'll read up on debugging with glGetError... On Tue, Jan 2, 2018 at 7:37 PM, Ian Mallett <[email protected]> wrote: > On Tue, Jan 2, 2018 at 12:33 AM, JP LeBreton <[email protected]> wrote= : > >> I have a program (http://vectorpoem.com/playscii) that's been running >> nicely with PyOpenGL on x86 Linux, macOS, and Windows for a few years no= w, >> and I'm now attempting to get it running on a Raspberry Pi 3 (using the >> Raspbian OpenGL driver). Until now this process was pretty straightforwa= rd, >> tweaking shaders and providing a render path for non-VAO hardware, but I= 've >> now hit a crash I don't understand and can't figure out how to debug. >> >> Deep into program initialization, I'm setting up some vertex buffers, an= d >> get a crash whose final line is "OpenGL.error.Error: Attempt to retrieve >> context when no valid context" when calling glVertexAttribPointer. See t= he >> full log here; my program first logs info about the hardware and the Ope= nGL >> context it creates (via PySDL2), followed by the crash: >> >> https://gist.github.com/JPLeBreton/782b92872380ee6ab3b11b3954ca56cd >> >> The OpenGL render context is definitely present; I tried logging stuff >> about it just before the glVertexAttribPointer call and as far as I can >> tell it's valid right up until that point. For what it's worth that call >> does appear to be the first (of many) in the program's execution. >> > > =E2=80=8BIt's not enough for the context to be present; it must also be "= current" > on the thread and window from which the GL command is issued. I'm not > especially familiar with SDL2 and its requirements, but I should think > `SDL_GL_MakeCurrent(...)` after creating your window and before calling a= ny > GL commands would do it. > > If this turns out not to be the issue, I'd suggest some well-placed > `glGetError(...)`s. I don't know if mixing PyOpenGL with PySDL2 is okay, > either=E2=80=94in C++, at least, SDL provides its own GL binding . . . bu= t Mike > would know. Also your repo <https://bitbucket.org/JPLeBreton/playscii> > doesn't seem to match the error perfectly; I assume you made a few change= s > since. > > GL context creation is ludicrously fraught, even in the more-modern API > revisions=E2=80=94and I've found it to be particularly buggy on *nix grap= hics > drivers, especially Debian-based Linuxes. So. > > Ian > --001a113ed240d13f440561d8b6cc Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div><div>Thanks for the reply. The context does seem to b= e the window's current one, SDL_GL_MakeCurrent didn't change anythi= ng. I'm running it from the Raspbian Pixel desktop and made sure there = are no other SDL2 windows nor OpenGL contexts active on the system, just in= case that was a factor.<br></div><br>Correct, I did have a few local uncom= mitted changes - as of about 15 minutes ago the current state of the repo s= hould reproduce the error on a Pi 3.<br><br></div>PySDL2 and PyOpenGL have = been working fine together for this application on x86[_64] Linux, macOS, a= nd Windows, on Intel and Nvidia GPUs, but I realize the Pi is a fairly diff= erent environment and drivers play a large role. I'll read up on debugg= ing with glGetError...<br></div><div class=3D"gmail_extra"><br><div class= =3D"gmail_quote">On Tue, Jan 2, 2018 at 7:37 PM, Ian Mallett <span dir=3D"l= tr"><<a href=3D"mailto:[email protected]" target=3D"_blank">ian@geometr= ian.com</a>></span> wrote:<br><blockquote class=3D"gmail_quote" style=3D= "margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D= "ltr"><div class=3D"gmail_extra"><span class=3D"">On Tue, Jan 2, 2018 at 12= :33 AM, JP LeBreton <span dir=3D"ltr"><<a href=3D"mailto:jplebreton@gmai= l.com" target=3D"_blank">[email protected]</a>></span> wrote:<br></sp= an><div class=3D"gmail_quote"><span class=3D""><blockquote class=3D"gmail_q= uote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,2= 04);padding-left:1ex"><div dir=3D"auto"><div dir=3D"ltr">I have a program (= <a href=3D"http://vectorpoem.com/playscii" target=3D"_blank">http://vectorp= oem.com/playsci<wbr>i</a>) that's been running nicely with PyOpenGL on = x86 Linux, macOS, and Windows for a few years now, and I'm now attempti= ng to get it running on a Raspberry Pi 3 (using the Raspbian OpenGL driver)= . Until now this process was pretty straightforward, tweaking shaders and p= roviding a render path for non-VAO hardware, but I've now hit a crash I= don't understand and can't figure out how to debug.<br><br>Deep in= to program initialization, I'm setting up some vertex buffers, and get = a crash whose final line is "OpenGL.error.Error: Attempt to retrieve c= ontext when no valid context" when calling glVertexAttribPointer. See = the full log here; my program first logs info about the hardware and the Op= enGL context it creates (via PySDL2), followed by the crash:<br><br><a href= =3D"https://gist.github.com/JPLeBreton/782b92872380ee6ab3b11b3954ca56cd" ta= rget=3D"_blank">https://gist.github.com/JPLeBr<wbr>eton/782b92872380ee6ab3b= 11b395<wbr>4ca56cd</a><br><br>The OpenGL render context is definitely prese= nt; I tried logging stuff about it just before the glVertexAttribPointer ca= ll and as far as I can tell it's valid right up until that point. For w= hat it's worth that call does appear to be the first (of many) in the p= rogram's execution.<br></div></div></blockquote><div><br></div></span><= div><div style=3D"font-family:times new roman,serif" class=3D"gmail_default= ">=E2=80=8BIt's not enough for the context to be present; it must also = be "current" on the thread and window from which the GL command i= s issued. I'm not especially familiar with SDL2 and its requirements, b= ut I should think `SDL_GL_MakeCurrent(...)` after creating your window and = before calling any GL commands would do it.</div><div style=3D"font-family:= times new roman,serif" class=3D"gmail_default"><br></div><div style=3D"font= -family:times new roman,serif" class=3D"gmail_default">If this turns out no= t to be the issue, I'd suggest some well-placed `glGetError(...)`s. I d= on't know if mixing PyOpenGL with PySDL2 is okay, either=E2=80=94in C++= , at=20 least, SDL provides its own GL binding . . . but Mike would know. Also <a h= ref=3D"https://bitbucket.org/JPLeBreton/playscii" target=3D"_blank">your re= po</a> doesn't seem to match the error perfectly; I assume you made a f= ew changes since.<br></div><div style=3D"font-family:times new roman,serif"= class=3D"gmail_default"><br></div><div style=3D"font-family:times new roma= n,serif" class=3D"gmail_default">GL context creation is ludicrously fraught= , even in the more-modern API revisions=E2=80=94and I've found it to be= particularly buggy on *nix graphics drivers, especially Debian-based Linux= es. So.<span class=3D"HOEnZb"><font color=3D"#888888"><br></font></span></d= iv><span class=3D"HOEnZb"><font color=3D"#888888"><div style=3D"font-family= :times new roman,serif" class=3D"gmail_default"><br></div><div style=3D"fon= t-family:times new roman,serif" class=3D"gmail_default">Ian<br></div></font= ></span></div></div></div></div> </blockquote></div><br></div> --001a113ed240d13f440561d8b6cc-- --===============0959053762955836152== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot --===============0959053762955836152== 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 --===============0959053762955836152==--