Re: [PyOpenGL-Users] "Attempt to retrieve context when no valid context" when calling glVertexAttri
Brought to you by:
mcfletch
From: JP L. <jpl...@gm...> - 2018-01-03 05:44:59
|
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 <ia...@ge...> wrote: > On Tue, Jan 2, 2018 at 12:33 AM, JP LeBreton <jpl...@gm...> 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 now, >> 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 straightforward, >> 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, and >> get a crash whose final line is "OpenGL.error.Error: Attempt to retrieve >> context when no valid context" when calling glVertexAttribPointer. See the >> full log here; my program first logs info about the hardware and the OpenGL >> 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. >> > > It'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 any > 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—in C++, at least, SDL provides its own GL binding . . . but 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 changes > since. > > GL context creation is ludicrously fraught, even in the more-modern API > revisions—and I've found it to be particularly buggy on *nix graphics > drivers, especially Debian-based Linuxes. So. > > Ian > |