Closed drlight-code closed 8 years ago
This might be a multithreading issue, as I notice the threadpool in your callstack. I would suggest to check if all OpenGL calls are made in the same thread in which the OpenGL context was created.
Well.. this is a bit tricky. The library (http://juce.com) who just released their new major version this night, makes heavy use of threading in order to render into shared GL contexts for each UI "Component" they provide. Do offscreen FBO rendering in own thread with own (shared) context, then blit all this together finally in the UI thread. The library was developed in the audio context, and it is obvious that they are missing a bit of conceptual understanding regarding GL matters. I've talked to the lead dev, they are to some extent aware of those conceptional problems, however for the time being, this is what I have to deal with. Any advice on how to go about this?
Edit: Checking, doing what you already told me.. Will see if I can dig through this.
Still, any idea why the include thing doesn't behave as I expect? Do you think define/undef'ing the include guard before/after glx.h inclusion in their library is a reasonable way to go about this?
The main issue with multiple contexts in multiple threads regarding glbinding is, that glbinding has to be told which OpenGL context is current for each thread.
So it seems like you missed some glbinding::Binding::initialize()
and glbinding::Binding::useCurrentContext()
. For further explanation, see https://github.com/cginternals/glbinding/wiki/Initialization.
The issue concerning the include of glbinding headers is a more severe one. Basically, glbinding is a total replacement of any other OpenGL header library. This means, that using two or more of them in one cpp
file (a compilation unit) leads to semantic and in our case even compilation errors. We suggest you separate the code that needs the original glx headers from those using the glbinding headers.
Great advice, went through their framework, identified the context initialization and switching locations, added those calls, and everything is working smoothly now! My include-guard hack seems not to mess anything up as well, since I removed the actual calls to glx for extension queries as well. This needs to be properly cleaned/separated still of course. Thanks for your support and that awesome library of yours! Have a restful night, closing issue.
Hi! Starting off with glbindings. I have my own project with GLFW+glbindings which is just fine. Then there's this external library which does bindings kinda on it's own, failing to provide anything above OpenGL2 (ridiculous). I fixed stuff in their code s.t. native headers aren't included (toggled via a _NO_GLINCLUDES define) and made everything properly typed/consistent. So far so good. I get a runtime exception however when running that code:
Stacktrace:
Have built glbindings master debug version, stepped into it, the pos is -1 in that frame.
So I wonder if I'm missing something basic here before I dig further into this. One potential cause of error I see is the following. The project includes, for their custom extension handling, the glx.h header, which in turn includes gl.h. Something was strange with the include order: although I put the glbinding headers before that glx header inclusion, I got redefined symbols in gl.h. I don't quite get that since I thought a second inclusion of gl.h should run against the include guard? Doesn't glbinding set the __glh define in order to avoid this problem? Anyways that's what I did by myself and it seems things don't work as I expect after all.