OpenGLContext madness?

Hi :slight_smile:

I am writing a program that needs to render some OpenGL graphics so i wrote a class that inherits from OpenGLAppComponent.
This class contains a pointer to another object that manages OpenGL objects and therefore needs a valid OpenGLContext in order to work. To this end it contains a OpenGLContext pointer.

I setup my GL objects from the initialise() method inherited from OpenGLAppComponent as advised by the documentation.
Just before doing so, i simply set the context in the object that needs it with the context in the OpenGLAppComponent.

Everything seem to be ok (valid context) just before the method that should initialize all the GL object is called.

Here are some screens from the debugger:

Before entering the initGLObjects() method, the context of both the component and the other class are OK.

But when i step into it, it suddenly gets messed up.

Then the following init() functions use the context, i get a segfault there

What happened ?
What did i do wrong ?

Thanks for the help,
Adrien :slight_smile:

So it actually doesn’t work or what? Does it throw a runtime error / segfault?

What you’re showing in the images seems like the behaviour of the debugger before you actually step into the stack frame. Notice the “instruction pointer” is still at the braces of the function.

I know, i just captured the frame right after but it stays like this in the function. So yes it does segfault when i try to call some context->* function, i should have been more precise :slight_smile: