PrevUpHomeNext

Compile-time configuration

Site-configuration
Compiler capabilities
General configuration
GL-related
Strings
Error-related
Enumerations
Object-related

This section describes compile-time preprocessor symbols that can be used to configure several aspects of OGLplus.

Most of the options are set either to a zero or a non-zero integer value to disable or enable the behavior controlled by the option.

All options have a default value which can be overriden by setting the option (by defining the PP symbol) before the appropriate header file (one of oglplus/config/*.hpp) is processed, either by editing the oglplus/site_config.hpp file or by using the -D compiler option (or its equivalent for defining preprocessor symbols on the command-line or in an IDE).

#include <oglplus/config/site.hpp>

The cmake-based build system detects the compiler-capabilities, installed third-party libraries and supported GL version and extensions and generates two site configuration files oglplus/config/site.hpp and oglplus/config/fix_gl_version.hpp (located in the $(BUILD_DIR)/include subdirectory). User applications can reuse these files if the same compiler, GL API library and external libraries are used or can disable their use by defining the OGLPLUS_NO_SITE_CONFIG preprocessor symbol.

Alternatively the user can define their own oglplus/config/site.hpp file (either as a system-wide or application-specific configuration) and set the options described below to values (either zero or non-zero integer) appropriate to their system setup and used compiler.

This header should generally not be used by the library end-users. In order to detect the compiler capabilities use the compiler configuration header.

The first set of options concerns the availability of third-party libraries used by some parts of the code.

#define OGLPLUS_OPENAL_FOUND <UNSPECIFIED> 1
#define OGLPLUS_PNG_FOUND <UNSPECIFIED> 2
#define OGLPLUS_PANGO_CAIRO_FOUND <UNSPECIFIED> 3

#ifndef OGLPLUS_LOW_PROFILE
#define OGLPLUS_LOW_PROFILE <UNSPECIFIED> 4
#endif

1

Indicates if OpenAL is available and should be used.

2

Indicates if LibPNG was found and should be used.

3

Indicates if Pango/Cairo was found and should be used.

4

The low-profile mode can be set through the configuration script.

The following options select which GL API library (GL/glcorearb.h, GL3/gl3.h, GL/glew.h, etc.) is used when the OGLplus' oglplus/gl.hpp header is included. The first one defined as a non-zero integer value in the order as listed here, is used. At least one of the options listed here must be non-zero.

#ifndef OGLPLUS_USE_GLCOREARB_H 1
# define OGLPLUS_USE_GLCOREARB_H <UNSPECIFIED>
#endif
#ifndef OGLPLUS_USE_GL3_H 2
# define OGLPLUS_USE_GL3_H <UNSPECIFIED>
#endif
#ifndef OGLPLUS_USE_GLEW 3
# define OGLPLUS_USE_GLEW <UNSPECIFIED>
#endif
#ifndef OGLPLUS_USE_GL3W 4
# define OGLPLUS_USE_GL3W <UNSPECIFIED>
#endif

1

Indicates that GL/glcorearb.h + the GL binary library should be used.

2

Indicates that GL3/gl3.h + the GL binary library should be used.

3

Indicates that GLEW should be used.

4

Indicates that GL3W should be used.

The next option enables or disables the usage of the Boost.Config library for compiler configuration. If set to a non-zero integer the boost/config.hpp header is included, otherwise it is not.

#ifndef OGLPLUS_USE_BOOST_CONFIG
# define OGLPLUS_USE_BOOST_CONFIG <UNSPECIFIED>
#endif

The following options indicate compiler capabilities. If one of these options is set to a non-zero integer value, the corresponding capability is not implemented. The first set of options listed right below are overridden by Boost.Config (when OGLPLUS_USE_BOOST_CONFIG is set to a non-zero value), if they are not defined before including this header by other means.

#if !OGLPLUS_USE_BOOST_CONFIG

#ifndef OGLPLUS_NO_SCOPED_ENUMS 1
# define OGLPLUS_NO_SCOPED_ENUMS <UNSPECIFIED>
#endif

#ifndef OGLPLUS_NO_VARIADIC_MACROS 2
# define OGLPLUS_NO_VARIADIC_MACROS <UNSPECIFIED>
#endif

#ifndef OGLPLUS_NO_VARIADIC_TEMPLATES 3
# define OGLPLUS_NO_VARIADIC_TEMPLATES <UNSPECIFIED>
#endif

#ifndef OGLPLUS_NO_UNIFIED_INITIALIZATION_SYNTAX 4
# define OGLPLUS_NO_UNIFIED_INITIALIZATION_SYNTAX <UNSPECIFIED>
#endif

#ifndef OGLPLUS_NO_INITIALIZER_LISTS 5
# define OGLPLUS_NO_INITIALIZER_LISTS <UNSPECIFIED>
#endif

#ifndef OGLPLUS_NO_DEFAULTED_FUNCTIONS 6
# define OGLPLUS_NO_DEFAULTED_FUNCTIONS <UNSPECIFIED>
#endif

#ifndef OGLPLUS_NO_DELETED_FUNCTIONS 7
# define OGLPLUS_NO_DELETED_FUNCTIONS <UNSPECIFIED>
#endif

#ifndef OGLPLUS_NO_EXPLICIT_CONVERSION_OPERATORS 8
# define OGLPLUS_NO_EXPLICIT_CONVERSION_OPERATORS <UNSPECIFIED>
#endif

#ifndef OGLPLUS_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS 9
# define OGLPLUS_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS <UNSPECIFIED>
#endif

#ifndef OGLPLUS_NO_UNICODE_LITERALS 10
# define OGLPLUS_NO_UNICODE_LITERALS <UNSPECIFIED>
#endif

#ifndef OGLPLUS_NO_USER_DEFINED_LITERALS 11
# define OGLPLUS_NO_USER_DEFINED_LITERALS <UNSPECIFIED>
#endif

#ifndef OGLPLUS_NO_TEMPLATE_ALIASES 12
# define OGLPLUS_NO_TEMPLATE_ALIASES <UNSPECIFIED>
#endif

1

Indicates that C++11 strongly typed enumerations are not supported.

2

Indicates that preprocessor variadic macros are not supported.

3

Indicates that C++11 variadic templates are not properly supported.

4

Indicates that C++11 unified initialization syntax is not implemented.

5

Indicates that C++11 initializer lists are not supported.

6

Indicates that C++11 defaulted functions are not supported.

7

Indicates that C++11 deleted functions are not supported.

8

Indicates that C++11 explicit conversion operators are not supported.

9

Indicates that C++11 default template arguments cannot be used.

10

Indicates that C++11 unicode string literals are not supported.

11

Indicates that C++11 user-defined literals are not supported.

12

Indicates that C++11 template aliases are not supported.

#ifndef OGLPLUS_NO_CONSTEXPR 1
# define OGLPLUS_NO_CONSTEXPR <UNSPECIFIED>
#endif

#ifndef OGLPLUS_NO_OVERRIDE 2
# define OGLPLUS_NO_OVERRIDE <UNSPECIFIED>
#endif

#ifndef OGLPLUS_NO_NOEXCEPT 3
# define OGLPLUS_NO_NOEXCEPT <UNSPECIFIED>
#endif

#ifndef OGLPLUS_NO_LAMBDAS 4
# define OGLPLUS_NO_LAMBDAS <UNSPECIFIED>
#endif

#endif //!OGLPLUS_USE_BOOST_CONFIG

1

Indicates that C++11 generalized constant expressions are not supported.

2

Indicates that C++11 explicit virtual override is not supported.

3

Indicates that C++11 noexcept specifier is not supported.

4

Indicates that C++11 lambdas are not supported.

The next options are not influenced by Boost.Config.

#ifndef OGLPLUS_NO_INHERITED_CONSTRUCTORS 1
# define OGLPLUS_NO_INHERITED_CONSTRUCTORS <UNSPECIFIED>
#endif

#ifndef OGLPLUS_NO_CHRONO 2
# define OGLPLUS_NO_CHRONO <UNSPECIFIED>
#endif

#ifndef OGLPLUS_NO_THREADS 3
# define OGLPLUS_NO_THREADS <UNSPECIFIED>
#endif

#ifndef OGLPLUS_NO_SCOPED_ENUM_TEMPLATE_PARAMS 4
#define OGLPLUS_NO_SCOPED_ENUM_TEMPLATE_PARAMS <UNSPECIFIED>
#endif

1

Indicates that C++11 inherited constructors are not supported.

2

Indicates that the standard chrono header is not available.

3

Indicates that the C++11 threads implementation is not available.

4

Indicates that using C++11 scoped enumerations as template parameters is not supported or not implemented correctly.

#include <oglplus/config/compiler.hpp>

This header is used by the rest of the library to determine the capabilities of the currently used compiler. The values are taken either externally from the build system through the compiler command-line or an IDE or from the site-configuration header or from the Boost.Config library.

#ifndef OGLPLUS_NO_SITE_CONFIG 1
# include <oglplus/config/site.hpp>
#endif

#ifndef OGLPLUS_USE_BOOST_CONFIG 2
# define OGLPLUS_USE_BOOST_CONFIG 0
#endif

#if OGLPLUS_USE_BOOST_CONFIG
# include <boost/config.hpp>
#endif

// The default values for the preprocessor symbols indicating
// compiler capabilities are also defined here.

1

Disables the usage of the automatically-generated site configuration header.

2

Enables the use of the Boost.Config library for the detection of compiler capabilities. If not set in the site-config nor defined otherwise, the use of Boost.Config is disabled by default.

#include <oglplus/config/basic.hpp>

This section lists general compile-time configuration options of OGLplus.

#ifndef OGLPLUS_LOW_PROFILE
# define OGLPLUS_LOW_PROFILE 0 1
#endif

#ifndef OGLPLUS_LINK_LIBRARY
# define OGLPLUS_LINK_LIBRARY 0 2
#endif

#ifndef OGLPLUS_NO_SITE_CONFIG 3
# include <oglplus/config/site.hpp>
#endif

1

Compile-time option enabling the low-profile mode. In the low-profile mode some features (like object descriptions, enumeration value names, some file and line info atached to exceptions, etc. useful during development and debugging) are disabled, resulting in both smaller binary executable sizes and lower run-time overhead for release builds of applications using OGLplus.

Setting this option to a non-zero integer value enables the low-profile mode, setting it to zero disables it. By default the low-profile mode is disabled.

This option influences the default value of several other configuration options. Their values can of course be set independently if required.

2

Compile-time switch enabling linking of some parts of OGLplus from a binary library. Certain parts of OGLplus (mostly complicated functions and functions where static variables or long string literals are used) can be built into a separate library that can be then linked to applications. If this option is set to zero, then everything is inlined. If it is set to a nonzero integer value, then some functions are just declared and must be built separatelly and linked to the final executable.

The oglplus/lib.hpp header file can be included into one of the translation units when building the library or the final executable to include the implementations of all such functions.

By default this option is set to 0 - everything is inlined.

3

Disables the usage of the automatically-generated site configuration header.

#include <oglplus/config/gl.hpp>

The preprocessor options in this category influence behaviour related to interfacing between OGLplus and the GL API.

#define GLAPIENTRY 1

1

Definition of the GLAPIENTRY calling convention used by most of the GL API functions.

#ifndef OGLPLUS_NO_GLFUNC_CHECKS 1
# define OGLPLUS_NO_GLFUNC_CHECKS OGLPLUS_LOW_PROFILE
#endif

#ifndef OGLPLUS_NO_UNIFORM_TYPECHECK 2
# define OGLPLUS_NO_UNIFORM_TYPECHECK OGLPLUS_LOW_PROFILE
#endif

1

Compile-time switch disabling checks of validity of pointers to GL functions. Setting this preprocessor symbol to a nonzero value causes that if the OpenGL functions are called through a pointer, then that pointer is checked before it is used to call the function. If enabled and a pointer to a GL function is nullptr then the MissingFunction exception is thrown. This check can safely be disabled if functions from the GL API are not called through pointers. By default this option is set to the same value as OGLPLUS_LOW_PROFILE, i.e. the function pointer checks are enabled, when not in low-profile mode, and disabled otherwise. The check however requires variadic templates. If variadic templates are not available, then the checks are disabled.

2

Compile-time switch entirely disabling typechecking of uniforms. Setting this preprocessor symbol to a nonzero value causes the Uniform variables are not typechecked. By default this option is set to the same value as OGLPLUS_LOW_PROFILE, i.e. typechecking of uniforms is enabled when not in low-profile mode, and disabled otherwise.

#include <oglplus/config/string.hpp>

The following options influence the behaviour of OGLplus string wrappers.

#ifndef OGLPLUS_NO_UTF8_CHECKS 1
# define OGLPLUS_NO_UTF8_CHECKS OGLPLUS_LOW_PROFILE
#endif

1

Compile-time switch disabling UTF-8 validity checks in various functions. Setting this preprocessor symbol to a nonzero value causes that the String constructors skip their UTF-8 validity checks. By default this option is set to the same value as OGLPLUS_LOW_PROFILE, i.e. the UTF-8 validity checks are enabled, when not in low-profile mode and disabled otherwise.

#include <oglplus/config/error.hpp>

The following options disable some of the attributes of OGLplus' exception classes. By disabling we mean, that various member functions of Error or its descendants, (like SourceFunc, SourceLine, etc.) return a default value (nullptr, zero, empty string, etc.) instead of the real value related to a raised error.

When fully enabled, Error provides quite a lot of information about an error that occured during the execution of OGLplus code. While this information may be useful during debugging, it also requires additional memory to store and program instructions to initialize in an instance of Error.

Disabling certain attributes may be useful in release builds when most bugs have been fixed and such a detailed diagnostic is not required. Doing so will most probably lead to both a decrease in code size and CPU overhead.

#ifndef OGLPLUS_ERROR_NO_FILE 1
# define OGLPLUS_ERROR_NO_FILE OGLPLUS_LOW_PROFILE
#endif

#ifndef OGLPLUS_ERROR_NO_LINE 2
# define OGLPLUS_ERROR_NO_LINE OGLPLUS_LOW_PROFILE
#endif

#ifndef OGLPLUS_ERROR_NO_FUNC 3
# define OGLPLUS_ERROR_NO_FUNC OGLPLUS_LOW_PROFILE
#endif

#ifndef OGLPLUS_ERROR_NO_GL_LIB 4
# define OGLPLUS_ERROR_NO_GL_LIB 0
#endif

#ifndef OGLPLUS_ERROR_NO_GL_FUNC 5
# define OGLPLUS_ERROR_NO_GL_FUNC 0
#endif

#ifndef OGLPLUS_ERROR_NO_GL_SYMBOL 6
# define OGLPLUS_ERROR_NO_GL_SYMBOL 0
#endif

1

Disables the SourceFile attribute of Error. Disabled in low-profile mode.

2

Disables the SourceLine attribute of Error. Disabled in low-profile mode.

3

Disables the SourceFunc attribute of Error. Disabled in low-profile mode.

4

Disables the GLLib attribute of Error. Enabled by default.

5

Disables the GLFunc attribute of Error. Enabled by default.

6

Disables the EnumParam, EnumParamName and Index attributes of Error. Enabled by default.

#include <oglplus/config/enums.hpp>

The preprocessor options defined here control behavior related to the OGLplus enumerations. The functions for iteration through all available values in an enumerated type and the functions for returning the GL names of the enumeration values can be either enabled or disabled by these options.

#ifndef OGLPLUS_NO_ENUM_VALUE_NAMES 1
# define OGLPLUS_NO_ENUM_VALUE_NAMES OGLPLUS_LOW_PROFILE
#endif

#ifndef OGLPLUS_NO_ENUM_VALUE_RANGES 2
# define OGLPLUS_NO_ENUM_VALUE_RANGES OGLPLUS_LOW_PROFILE
#endif

#ifndef OGLPLUS_NO_ENUM_VALUE_CLASSES 3
# define OGLPLUS_NO_ENUM_VALUE_CLASSES OGLPLUS_NO_SCOPED_ENUM_TEMPLATE_PARAMS
#endif

1

Compile-time switch disabling the functions returning enumerated value names. Setting this preprocessor symbol to a non-zero value causes that the EnumValueName functions always return an empty string. When set to zero these functions return a textual name of an enumerated value passed as argument.

By default this option is set to the same value as OGLPLUS_LOW_PROFILE, i.e. enumeration value names are enabled, when not in low-profile mode and disabled otherwise.

2

Compile-time switch disabling the functions returning enumerated value ranges. Setting this preprocessor symbol to a nonzero value causes that the EnumValueRange functions always return an empty range. When set to zero these functions return a range of all values in the enumeration passed as the template argument.

By default this option is set to the same value as OGLPLUS_LOW_PROFILE, i.e. enumeration value ranges are enabled, when not in low-profile mode and disabled otherwise.

3

Compile-time switch disabling the specializations of enums::EnumToClass. Setting this preprocessor symbol to a nonzero value causes that the enums::EnumToClass templates to be unspecialized for the individual enums.

By default this option is set to zero (except on compilers where template specializations for enum-class is not implemented properly).

#include <oglplus/config/object.hpp>

The following preprocessor options influence behaviour related to OGLplus objects.

The following options enable or disable the texture OGLplus object descriptions.

[Note] Note

Object descriptions use statically initialized data which may cause problems if the final executable is built together from several different object files. Because of this, if object descriptions are enabled it is recommended that OGLplus applications are built with OGLPLUS_LINK_LIBRARY set to non-zero or are built as a single translation unit.

#ifndef OGLPLUS_NO_OBJECT_DESC 1
# define OGLPLUS_NO_OBJECT_DESC OGLPLUS_LOW_PROFILE
#endif

1

Compile-time switch disabling textual object descriptions. Setting this preprocessor option to a non-zero integer value disables the OGLplus object description attached to various instantiations of the Object template (like Program, Shader, Texture, etc.) during construction, by the means of the ObjectDesc parameter in constructor of Object. By default this option is set to the same value as OGLPLUS_LOW_PROFILE, i.e. objects descriptions are enabled, when not in low-profile mode and disabled otherwise.


PrevUpHomeNext