Hiya,
I just thought I'd share a problem I encountered incorporating a 3rd party opengl-based UI library into my game.
There were some SFML functions which, if called, would cause problems with the UI library, such as corrupt or missing graphics. It turns out the problem was that these SFML functions create a new sf::Context. Example:
Texture.cpp unsigned int checkMaximumTextureSize()
{
// Create a temporary context in case the user queries
// the size before a GlResource is created, thus
// initializing the shared context
sf::Context context;
GLint size;
glCheck(glGetIntegerv(GL_MAX_TEXTURE_SIZE, &size));
return static_cast<unsigned int>(size);
}
The code comments make it obvious why this is done. And that makes sense. However, in my case this led to quite a bit of debugging while incorporating the UI library. Granted, I am quite clueless about low level OpenGL code, and I'm sure an expert may have discovered the problem more quickly. And the solution is simple, once you understand the problem - just ensure to call setActive again on the RenderWindow (or whatever target you're rendering to).
Regardless, to save others the trouble in the future, perhaps it might be worth it to check for an existing context first, before creating a new one? And only create a new context if none is already present.
If there's good reasons not to do this, no problem. I'm just sharing a user experience with SFML here. It's one of the few times it's caused me some trouble.