1 // Created on: 2013-08-25
2 // Created by: Kirill GAVRILOV
3 // Copyright (c) 2013-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _OpenGl_Caps_H__
17 #define _OpenGl_Caps_H__
19 #include <Standard_Type.hxx>
20 #include <Standard_Transient.hxx>
21 #include <OpenGl_ShaderProgramDumpLevel.hxx>
23 //! Class to define graphic driver capabilities.
24 //! Notice that these options will be ignored if particular functionality does not provided by GL driver
25 class OpenGl_Caps : public Standard_Transient
28 public: //! @name flags to disable particular functionality, should be used only for testing purposes!
30 Standard_Boolean sRGBDisable; //!< Disables sRGB rendering (OFF by default)
31 Standard_Boolean vboDisable; //!< disallow VBO usage for debugging purposes (OFF by default)
32 Standard_Boolean pntSpritesDisable; //!< flag permits Point Sprites usage, will significantly affect performance (OFF by default)
33 Standard_Boolean keepArrayData; //!< Disables freeing CPU memory after building VBOs (OFF by default)
34 Standard_Boolean ffpEnable; //!< Enables FFP (fixed-function pipeline), do not use built-in GLSL programs (OFF by default)
35 Standard_Boolean usePolygonMode; //!< Enables Polygon Mode instead of built-in GLSL programs (OFF by default; unsupported on OpenGL ES)
36 Standard_Boolean useSystemBuffer; //!< Enables usage of system backbuffer for blitting (OFF by default on desktop OpenGL and ON on OpenGL ES for testing)
37 Standard_Integer swapInterval; //!< controls swap interval - 0 for VSync off and 1 for VSync on, 1 by default
39 public: //! @name context creation parameters
42 * Specify that driver should not swap back/front buffers at the end of frame.
43 * Useful when OCCT Viewer is integrated into existing OpenGL rendering pipeline as part,
44 * thus swapping part is performed outside.
48 Standard_Boolean buffersNoSwap;
51 * Request stereoscopic context (with Quad Buffer). This flag requires support in OpenGL driver.
55 Standard_Boolean contextStereo;
58 * Request debug GL context. This flag requires support in OpenGL driver.
60 * When turned on OpenGL driver emits error and warning messages to provided callback
61 * (see OpenGl_Context - messages will be printed to standard output).
62 * Affects performance - thus should not be turned on by products in released state.
66 Standard_Boolean contextDebug;
69 * Request debug GL context to emit messages within main thread (when contextDebug is specified!).
71 * Some implementations performs GL rendering within dedicated thread(s),
72 * in this case debug messages will be pushed from unknown thread making call stack useless,
73 * since it does not interconnected to application calls.
74 * This option asks GL driver to switch into synchronized implementation.
75 * Affects performance - thus should not be turned on by products in released state.
79 Standard_Boolean contextSyncDebug;
82 * Disable hardware acceleration.
84 * This flag overrides default behavior, when accelerated context always preferred over software ones:
85 * - on Windows will force Microsoft software implementation;
86 * - on Mac OS X, forces Apple software implementation.
88 * Software implementations are dramatically slower - should never be used.
90 * OFF by default. Currently implemented only for Windows (WGL) and Mac OS X (Cocoa).
92 Standard_Boolean contextNoAccel;
95 * Request backward-compatible GL context. This flag requires support in OpenGL driver.
97 * Backward-compatible profile includes deprecated functionality like FFP (fixed-function pipeline),
98 * and might be useful for compatibility with application OpenGL code.
100 * Most drivers support all features within backward-compatibility profile,
101 * but some limit functionality to OpenGL 2.1 (e.g. OS X) when core profile is not explicitly requested.
103 * Requires OpenGL 3.2+ drivers.
104 * Has no effect on OpenGL ES 2.0+ drivers (which do not provie FFP compatibility).
105 * Interacts with ffpEnable option, which should be disabled within core profile.
109 Standard_Boolean contextCompatible;
112 * Disallow using OpenGL extensions.
113 * Should be used for debugging purposes only!
117 Standard_Boolean contextNoExtensions;
120 * Synthetically restrict upper version of OpenGL functionality to be used.
121 * Should be used for debugging purposes only!
123 * (-1, -1) by default, which means no restriction.
125 Standard_Integer contextMajorVersionUpper;
126 Standard_Integer contextMinorVersionUpper;
128 public: //! @name flags to activate verbose output
130 //! Print GLSL program compilation/linkage warnings, if any. OFF by default.
131 Standard_Boolean glslWarnings;
133 //! Suppress redundant messages from debug GL context. ON by default.
134 Standard_Boolean suppressExtraMsg;
136 //! Print GLSL program source code. OFF by default.
137 OpenGl_ShaderProgramDumpLevel glslDumpLevel;
139 public: //! @name class methods
141 //! Default constructor - initialize with most optimal values.
142 Standard_EXPORT OpenGl_Caps();
145 Standard_EXPORT virtual ~OpenGl_Caps();
148 Standard_EXPORT OpenGl_Caps& operator= (const OpenGl_Caps& theCopy);
153 OpenGl_Caps (const OpenGl_Caps& );
157 DEFINE_STANDARD_RTTIEXT(OpenGl_Caps,Standard_Transient) // Type definition
161 DEFINE_STANDARD_HANDLE(OpenGl_Caps, Standard_Transient)
163 #endif // _OpenGl_Caps_H__