Browse Source

Initial support for context flags.

pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
c4aa95a595
  1. 10
      src/Context.cpp
  2. 30
      src/Context.h

10
src/Context.cpp

@ -286,6 +286,16 @@ Context::Context() {
#endif
_version = static_cast<Version>(_majorVersion*100+_minorVersion*10);
/* Context flags are supported since GL 3.0 */
#ifndef MAGNUM_TARGET_GLES
/**
* @todo According to KHR_debug specs this should be also present in ES2
* if KHR_debug is available, but in headers it is nowhere to be found
*/
if(isVersionSupported(Version::GL300))
glGetIntegerv(GL_CONTEXT_FLAGS, reinterpret_cast<GLint*>(&_flags));
#endif
/* Get first future (not supported) version */
std::vector<Version> versions{
#ifndef MAGNUM_TARGET_GLES

30
src/Context.h

@ -30,6 +30,7 @@
#include <bitset>
#include <vector>
#include <Containers/EnumSet.h>
#include "Magnum.h"
#include "OpenGL.h"
@ -144,13 +145,36 @@ class MAGNUM_EXPORT Context {
Context& operator=(Context&&) = delete;
public:
/**
* @brief Context flag
*
* @see Flags, flags()
*/
enum class Flag: GLint {
#ifndef MAGNUM_TARGET_GLES3
/**
* Debug context
* @requires_gl43 %Extension @es_extension{KHR,debug}
* @requires_es_extension %Extension @es_extension{KHR,debug}
*/
Debug = GL_CONTEXT_FLAG_DEBUG_BIT
#endif
};
/**
* @brief Context flags
*
* @see flags()
*/
typedef Corrade::Containers::EnumSet<Flag, GLint> Flags;
/**
* @brief Constructor
*
* Constructed automatically, see class documentation for more
* information.
* @see @fn_gl{Get} with @def_gl{MAJOR_VERSION}, @def_gl{MINOR_VERSION},
* @fn_gl{GetString} with @def_gl{EXTENSIONS}
* @def_gl{CONTEXT_FLAGS}, @fn_gl{GetString} with @def_gl{EXTENSIONS}
*/
explicit Context();
@ -221,6 +245,9 @@ class MAGNUM_EXPORT Context {
return reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION));
}
/** @brief Context flags */
inline Flags flags() const { return _flags; }
/**
* @brief Supported extensions
*
@ -302,6 +329,7 @@ class MAGNUM_EXPORT Context {
Version _version;
Int _majorVersion;
Int _minorVersion;
Flags _flags;
std::bitset<128> extensionStatus;
std::vector<Extension> _supportedExtensions;

Loading…
Cancel
Save