Hi;
I use a thread for background loading which does load textures, and creates renderTextures.
The thread do a glFlush and go to idle when the load is finished.
If I don't add "sf::Context cx" to the function that load textures, there is no display.
If I add it, it displays fine.
void PD_Texture::LoadFromFile(const string& xFileName)
{
sf::Context cx; // if commented, no display
....
m_pxTexture = new sf::Texture();
m_pxTexture->loadFromMemory(pxBuffer, static_cast<size_t>(llSize));
}
So I use the sf::Context cx.
It works fine like this. But the problem happens when a second load happens.
In this second load, the textures are not loaded again (as they are still in memory), but the renderTextures are deleted, and recreated.
There is no more display, and I get a lot of OpenGL errors on the console, like:
"failed to activate OpenGL context"
Thanks for helping.