Warning
This page refers to an old version of SFML. Click here to switch to the latest version.
Warning
This page refers to an old version of SFML. Click here to switch to the latest version.
Class holding a valid drawing context. More...
#include <SFML/Window/Context.hpp>
Public Member Functions | |
| Context () | |
| Default constructor. | |
| ~Context () | |
| Destructor. | |
| bool | setActive (bool active) |
| Activate or deactivate explicitly the context. | |
| Context (const ContextSettings &settings, unsigned int width, unsigned int height) | |
| Construct a in-memory context. | |
Static Public Member Functions | |
| static GlFunctionPointer | getFunction (const char *name) |
| Get the address of an OpenGL function. | |
Class holding a valid drawing context.
If you need to make OpenGL calls without having an active window (like in a thread), you can use an instance of this class to get a valid context.
Having a valid context is necessary for every OpenGL call.
Note that a context is only active in its current thread, if you create a new thread it will have no valid context by default.
To use a sf::Context instance, just construct it and let it live as long as you need a valid context. No explicit activation is needed, all it has to do is to exist. Its destructor will take care of deactivating and freeing all the attached resources.
Usage example:
Definition at line 50 of file Context.hpp.
| sf::Context::Context | ( | ) |
Default constructor.
The constructor creates and activates the context
| sf::Context::~Context | ( | ) |
Destructor.
The destructor deactivates and destroys the context
| sf::Context::Context | ( | const ContextSettings & | settings, |
| unsigned int | width, | ||
| unsigned int | height ) |
Construct a in-memory context.
This constructor is for internal use, you don't need to bother with it.
| settings | Creation parameters |
| width | Back buffer width |
| height | Back buffer height |
|
static |
Get the address of an OpenGL function.
| name | Name of the function to get the address of |
| bool sf::Context::setActive | ( | bool | active | ) |
Activate or deactivate explicitly the context.
| active | True to activate, false to deactivate |