Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: When is the global shared context created??  (Read 1590 times)

0 Members and 1 Guest are viewing this topic.

mercurio7891

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
When is the global shared context created??
« 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

Code: [Select]

On first create of sf::Window
    create shared global context
    create render context and share with the global context


regards

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
When is the global shared context created??
« Reply #1 on: May 13, 2011, 08:57:06 am »
Which version of SFML? Why do you want to know that?
Laurent Gomila - SFML developer

mercurio7891

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
When is the global shared context created??
« Reply #2 on: May 13, 2011, 09:06:00 am »
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??

Code: [Select]

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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
When is the global shared context created??
« Reply #3 on: May 13, 2011, 09:42:43 am »
Quote
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.
Laurent Gomila - SFML developer

 

anything