globjects icon indicating copy to clipboard operation
globjects copied to clipboard

Example from the documentation on context initialization causes stack overflow

Open andesyv opened this issue 3 years ago • 0 comments

In the Initialize Contexts section of the documentation it states you can sync OpenGL contexts using glbinding by doing:

glbinding::Binding::addContextSwitchCallback([](glbinding::ContextHandle handle) {
    setContext(handle);
});

And then do

glbinding::Binding::useContext(handle);

to notify globjects and glbinding of the switch. But in source/globjects/source/globjects.cpp#L177 it looks like globjects::setContext(glbinding::ContextHandle handle) calls glbinding::Binding::useContext(glbinding::ContextHandle handle) internally, causing an infinite call chain and a stack overflow.

Just removing the section is probably enough to fix this, but it would be nice if it also explicitly states that the init, setContext and setCurrentContext globject functions also internally calls the glbinding equivalents.

andesyv avatar Mar 07 '22 19:03 andesyv