0030748: Visualization - Marker displayed in immediate layer ruins QT Quick view...
[occt.git] / src / OpenGl / OpenGl_Caps.hxx
CommitLineData
58655684 1// Created on: 2013-08-25
2// Created by: Kirill GAVRILOV
d5f74e42 3// Copyright (c) 2013-2014 OPEN CASCADE SAS
58655684 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
58655684 6//
d5f74e42 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
973c2be1 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.
58655684 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
58655684 15
16#ifndef _OpenGl_Caps_H__
17#define _OpenGl_Caps_H__
18
ec357c5c 19#include <Standard_Type.hxx>
58655684 20#include <Standard_Transient.hxx>
84e84755 21#include <OpenGl_ShaderProgramDumpLevel.hxx>
58655684 22
8625ef7e 23//! Class to define graphic driver capabilities.
58655684 24//! Notice that these options will be ignored if particular functionality does not provided by GL driver
25class OpenGl_Caps : public Standard_Transient
26{
27
abe46077 28public: //! @name flags to disable particular functionality, should be used only for testing purposes!
58655684 29
a577aaab 30 Standard_Boolean vboDisable; //!< flag permits VBO usage, will significantly affect performance (OFF by default)
31 Standard_Boolean pntSpritesDisable; //!< flag permits Point Sprites usage, will significantly affect performance (OFF by default)
392ac980 32 Standard_Boolean keepArrayData; //!< Disables freeing CPU memory after building VBOs (OFF by default)
2a332745 33 Standard_Boolean ffpEnable; //!< Enables FFP (fixed-function pipeline), do not use built-in GLSL programs (OFF by default)
34 Standard_Boolean usePolygonMode; //!< Enables Polygon Mode instead of built-in GLSL programs (OFF by default; unsupported on OpenGL ES)
c3282ec1 35 Standard_Boolean useSystemBuffer; //!< Enables usage of system backbuffer for blitting (OFF by default on desktop OpenGL and ON on OpenGL ES for testing)
f978241f 36 Standard_Integer swapInterval; //!< controls swap interval - 0 for VSync off and 1 for VSync on, 1 by default
58655684 37
38public: //! @name context creation parameters
39
abe46077 40 /**
25b97fac 41 * Specify that driver should not swap back/front buffers at the end of frame.
42 * Useful when OCCT Viewer is integrated into existing OpenGL rendering pipeline as part,
43 * thus swapping part is performed outside.
44 *
45 * OFF by default.
46 */
47 Standard_Boolean buffersNoSwap;
48
49 /**
abe46077 50 * Request stereoscopic context (with Quad Buffer). This flag requires support in OpenGL driver.
51 *
52 * OFF by default.
53 */
54 Standard_Boolean contextStereo;
55
56 /**
57 * Request debug GL context. This flag requires support in OpenGL driver.
58 *
59 * When turned on OpenGL driver emits error and warning messages to provided callback
60 * (see OpenGl_Context - messages will be printed to standard output).
61 * Affects performance - thus should not be turned on by products in released state.
62 *
d325cb7f 63 * OFF by default.
abe46077 64 */
65 Standard_Boolean contextDebug;
66
67 /**
c87535af 68 * Request debug GL context to emit messages within main thread (when contextDebug is specified!).
69 *
70 * Some implementations performs GL rendering within dedicated thread(s),
71 * in this case debug messages will be pushed from unknown thread making call stack useless,
72 * since it does not interconnected to application calls.
73 * This option asks GL driver to switch into synchronized implementation.
74 * Affects performance - thus should not be turned on by products in released state.
75 *
76 * OFF by default.
77 */
78 Standard_Boolean contextSyncDebug;
79
80 /**
abe46077 81 * Disable hardware acceleration.
82 *
83 * This flag overrides default behavior, when accelerated context always preferred over software ones:
84 * - on Windows will force Microsoft software implementation;
85 * - on Mac OS X, forces Apple software implementation.
86 *
87 * Software implementations are dramatically slower - should never be used.
88 *
89 * OFF by default. Currently implemented only for Windows (WGL) and Mac OS X (Cocoa).
90 */
91 Standard_Boolean contextNoAccel;
58655684 92
4e1523ef 93 /**
94 * Request backward-compatible GL context. This flag requires support in OpenGL driver.
95 *
96 * Backward-compatible profile includes deprecated functionality like FFP (fixed-function pipeline),
97 * and might be useful for compatibility with application OpenGL code.
98 *
99 * Most drivers support all features within backward-compatibility profile,
100 * but some limit functionality to OpenGL 2.1 (e.g. OS X) when core profile is not explicitly requested.
101 *
102 * Requires OpenGL 3.2+ drivers.
103 * Has no effect on OpenGL ES 2.0+ drivers (which do not provie FFP compatibility).
104 * Interacts with ffpEnable option, which should be disabled within core profile.
105 *
106 * ON by default.
107 */
108 Standard_Boolean contextCompatible;
109
392ac980 110public: //! @name flags to activate verbose output
111
112 //! Print GLSL program compilation/linkage warnings, if any. OFF by default.
113 Standard_Boolean glslWarnings;
e276548b 114
c87535af 115 //! Suppress redundant messages from debug GL context. ON by default.
116 Standard_Boolean suppressExtraMsg;
117
84e84755 118 //! Print GLSL program source code. OFF by default.
119 OpenGl_ShaderProgramDumpLevel glslDumpLevel;
120
58655684 121public: //! @name class methods
122
123 //! Default constructor - initialize with most optimal values.
124 Standard_EXPORT OpenGl_Caps();
125
126 //! Destructor.
127 Standard_EXPORT virtual ~OpenGl_Caps();
128
129 //! Copy maker.
130 Standard_EXPORT OpenGl_Caps& operator= (const OpenGl_Caps& theCopy);
131
132private:
133
134 //! Not implemented
135 OpenGl_Caps (const OpenGl_Caps& );
136
137public:
138
92efcf78 139 DEFINE_STANDARD_RTTIEXT(OpenGl_Caps,Standard_Transient) // Type definition
58655684 140
141};
142
143DEFINE_STANDARD_HANDLE(OpenGl_Caps, Standard_Transient)
144
145#endif // _OpenGl_Caps_H__