SFML community forums
Help => Window => Topic started by: mercurio7891 on May 13, 2011, 08:53:27 am
-
Hi, does sfml creates a global context for sharing. When is this global context created? Is it created when a sf::Window is created?
e.g
On first create of sf::Window
create shared global context
create render context and share with the global context
regards
-
Which version of SFML? Why do you want to know that?
-
for sfml2 :D
oh i was wondering say in the main thread if the global context is already created then i can create buffers etc and other opengl resource cache.
If not I would either create a sf::Context to do it which leads me to ask, would my created resources stay alive after the sf::Context dies??
void SetupResourceCache()
{
sf::Context temp_context;
create opengl buffer
create opengl texture
}
would my buffer and textures resources stay valid after the function?? I would be terribly happy if it does :D
regards
-
would my buffer and textures resources stay valid after the function??
Nop. You should instanciate a sf::Context at the beginning of your main() instead. This way you always have a valid OpenGL context in your main thread.