Added methods to get the currently active context, query whether an OpenGL extension is available and query the actual OpenGL version of a context, made context switches during initialization of texture and shader static values unnecessary, fixed code style in loaders.

This commit is contained in:
binary1248 2015-08-13 18:25:43 +02:00 committed by Lukas Dürrenberger
parent b7d7ac44f3
commit 2752bbcfb0
16 changed files with 1670 additions and 725 deletions

View file

@ -498,9 +498,6 @@ public:
/// the shader features. If it returns false, then
/// any attempt to use sf::Shader will fail.
///
/// Note: The first call to this function, whether by your
/// code or SFML will result in a context switch.
///
/// \return True if shaders are supported, false otherwise
///
////////////////////////////////////////////////////////////

View file

@ -472,9 +472,6 @@ public:
/// You can expect a value of 512 pixels for low-end graphics
/// card, and up to 8192 pixels or more for newer hardware.
///
/// Note: The first call to this function, whether by your
/// code or SFML will result in a context switch.
///
/// \return Maximum size allowed for textures, in pixels
///
////////////////////////////////////////////////////////////

View file

@ -77,7 +77,28 @@ public:
////////////////////////////////////////////////////////////
bool setActive(bool active);
public:
////////////////////////////////////////////////////////////
/// \brief Get the settings of the context
///
/// Note that these settings may be different than the ones
/// passed to the constructor; they are indeed adjusted if the
/// original settings are not directly supported by the system.
///
/// \return Structure containing the settings
///
////////////////////////////////////////////////////////////
const ContextSettings& getSettings() const;
////////////////////////////////////////////////////////////
/// \brief Check whether a given OpenGL extension is available
///
/// \param name Name of the extension to check for
///
/// \return True if available, false if unavailable
///
////////////////////////////////////////////////////////////
static bool isExtensionAvailable(const char* name);
////////////////////////////////////////////////////////////
/// \brief Get the address of an OpenGL function
///
@ -88,6 +109,14 @@ public:
////////////////////////////////////////////////////////////
static GlFunctionPointer getFunction(const char* name);
////////////////////////////////////////////////////////////
/// \brief Get the currently active context
///
/// \return The currently active context or NULL if none is active
///
////////////////////////////////////////////////////////////
static const Context* getActiveContext();
////////////////////////////////////////////////////////////
/// \brief Construct a in-memory context
///