Back to index

libsfml  1.6+dfsg2
Public Member Functions | Private Attributes
sf::priv::GraphicsContext Class Reference

RAII class ensuring a valid shared OpenGL context is bound to the current thread for all the lifetime of the instance. It also ensures all third party libraries (like GLEW) are properly initialized This class is for internal use only, it is required to solve tricky problems involving multi-threading /////////////////////////////////////////////////////////. More...

#include <GraphicsContext.hpp>

List of all members.

Public Member Functions

 GraphicsContext ()
 Default constructor, activate the global context if no other context is bound to the current thread.
 ~GraphicsContext ()
 Destructor, deactivate the global context if no other context was previously bound to the current thread.

Private Attributes

bool myActivated
 Keep track of the activation state of the global context.

Detailed Description

RAII class ensuring a valid shared OpenGL context is bound to the current thread for all the lifetime of the instance. It also ensures all third party libraries (like GLEW) are properly initialized This class is for internal use only, it is required to solve tricky problems involving multi-threading /////////////////////////////////////////////////////////.

Definition at line 52 of file GraphicsContext.hpp.


Constructor & Destructor Documentation

Default constructor, activate the global context if no other context is bound to the current thread.

Default constructor, activate the global context if no other context is bound to the current thread /////////////////////////////////////////////////////////.

/////////////////////////////////////////////////////////

Definition at line 63 of file GraphicsContext.cpp.

{
    // Activate the global context
    if (!Context::IsContextActive())
    {
        Context::GetGlobal().SetActive(true);
        myActivated = true;
    }
    else
    {
        myActivated = false;
    }

    // Make sure third party libraries are initialized
    InitGraphicsLibs();
}

Destructor, deactivate the global context if no other context was previously bound to the current thread.

Destructor, deactivate the global context if no other context was previously bound to the current thread /////////////////////////////////////////////////////////.

/////////////////////////////////////////////////////////

Definition at line 85 of file GraphicsContext.cpp.

{
    // Deactivate the global context
    if (myActivated)
        Context::GetGlobal().SetActive(false);
}

Member Data Documentation

Keep track of the activation state of the global context.

Definition at line 75 of file GraphicsContext.hpp.


The documentation for this class was generated from the following files: