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 |
25 | class OpenGl_Caps : public Standard_Transient |
26 | { |
27 | |
abe46077 |
28 | public: //! @name flags to disable particular functionality, should be used only for testing purposes! |
58655684 |
29 | |
ba00aab7 |
30 | Standard_Boolean sRGBDisable; //!< Disables sRGB rendering (OFF by default) |
faff3767 |
31 | Standard_Boolean compressedTexturesDisable; //!< Disables uploading of compressed texture formats native to GPU (OFF by default) |
ba00aab7 |
32 | Standard_Boolean vboDisable; //!< disallow VBO usage for debugging purposes (OFF by default) |
a577aaab |
33 | Standard_Boolean pntSpritesDisable; //!< flag permits Point Sprites usage, will significantly affect performance (OFF by default) |
392ac980 |
34 | Standard_Boolean keepArrayData; //!< Disables freeing CPU memory after building VBOs (OFF by default) |
2a332745 |
35 | Standard_Boolean ffpEnable; //!< Enables FFP (fixed-function pipeline), do not use built-in GLSL programs (OFF by default) |
36 | Standard_Boolean usePolygonMode; //!< Enables Polygon Mode instead of built-in GLSL programs (OFF by default; unsupported on OpenGL ES) |
c3282ec1 |
37 | Standard_Boolean useSystemBuffer; //!< Enables usage of system backbuffer for blitting (OFF by default on desktop OpenGL and ON on OpenGL ES for testing) |
f978241f |
38 | Standard_Integer swapInterval; //!< controls swap interval - 0 for VSync off and 1 for VSync on, 1 by default |
e70625d6 |
39 | Standard_Boolean useZeroToOneDepth; //!< use [0, 1] depth range instead of [-1, 1] range, when possible (OFF by default) |
58655684 |
40 | |
41 | public: //! @name context creation parameters |
42 | |
25b97fac |
43 | /** |
44 | * Specify that driver should not swap back/front buffers at the end of frame. |
45 | * Useful when OCCT Viewer is integrated into existing OpenGL rendering pipeline as part, |
46 | * thus swapping part is performed outside. |
47 | * |
48 | * OFF by default. |
49 | */ |
50 | Standard_Boolean buffersNoSwap; |
51 | |
31174e1a |
52 | /** |
53 | * Specify whether alpha component within color buffer should be written or not. |
54 | * With alpha write enabled, background is considered transparent by default |
55 | * and overridden by alpha value of last drawn object |
56 | * (e.g. it could be opaque or not in case of transparent material). |
57 | * With alpha writes disabled, color buffer will be kept opaque. |
58 | * |
59 | * OFF by default. |
60 | */ |
61 | Standard_Boolean buffersOpaqueAlpha; |
62 | |
abe46077 |
63 | /** |
64 | * Request stereoscopic context (with Quad Buffer). This flag requires support in OpenGL driver. |
65 | * |
66 | * OFF by default. |
67 | */ |
68 | Standard_Boolean contextStereo; |
69 | |
70 | /** |
71 | * Request debug GL context. This flag requires support in OpenGL driver. |
72 | * |
73 | * When turned on OpenGL driver emits error and warning messages to provided callback |
74 | * (see OpenGl_Context - messages will be printed to standard output). |
75 | * Affects performance - thus should not be turned on by products in released state. |
76 | * |
d325cb7f |
77 | * OFF by default. |
abe46077 |
78 | */ |
79 | Standard_Boolean contextDebug; |
80 | |
c87535af |
81 | /** |
82 | * Request debug GL context to emit messages within main thread (when contextDebug is specified!). |
83 | * |
84 | * Some implementations performs GL rendering within dedicated thread(s), |
85 | * in this case debug messages will be pushed from unknown thread making call stack useless, |
86 | * since it does not interconnected to application calls. |
87 | * This option asks GL driver to switch into synchronized implementation. |
88 | * Affects performance - thus should not be turned on by products in released state. |
89 | * |
90 | * OFF by default. |
91 | */ |
92 | Standard_Boolean contextSyncDebug; |
93 | |
abe46077 |
94 | /** |
95 | * Disable hardware acceleration. |
96 | * |
97 | * This flag overrides default behavior, when accelerated context always preferred over software ones: |
98 | * - on Windows will force Microsoft software implementation; |
99 | * - on Mac OS X, forces Apple software implementation. |
100 | * |
101 | * Software implementations are dramatically slower - should never be used. |
102 | * |
103 | * OFF by default. Currently implemented only for Windows (WGL) and Mac OS X (Cocoa). |
104 | */ |
105 | Standard_Boolean contextNoAccel; |
58655684 |
106 | |
4e1523ef |
107 | /** |
108 | * Request backward-compatible GL context. This flag requires support in OpenGL driver. |
109 | * |
110 | * Backward-compatible profile includes deprecated functionality like FFP (fixed-function pipeline), |
111 | * and might be useful for compatibility with application OpenGL code. |
112 | * |
113 | * Most drivers support all features within backward-compatibility profile, |
114 | * but some limit functionality to OpenGL 2.1 (e.g. OS X) when core profile is not explicitly requested. |
115 | * |
116 | * Requires OpenGL 3.2+ drivers. |
5e6e5914 |
117 | * Has no effect on OpenGL ES 2.0+ drivers (which do not provide FFP compatibility). |
4e1523ef |
118 | * Interacts with ffpEnable option, which should be disabled within core profile. |
119 | * |
120 | * ON by default. |
121 | */ |
122 | Standard_Boolean contextCompatible; |
123 | |
59515ca6 |
124 | /** |
125 | * Disallow using OpenGL extensions. |
126 | * Should be used for debugging purposes only! |
127 | * |
128 | * OFF by default. |
129 | */ |
130 | Standard_Boolean contextNoExtensions; |
131 | |
132 | /** |
133 | * Synthetically restrict upper version of OpenGL functionality to be used. |
134 | * Should be used for debugging purposes only! |
135 | * |
136 | * (-1, -1) by default, which means no restriction. |
137 | */ |
138 | Standard_Integer contextMajorVersionUpper; |
139 | Standard_Integer contextMinorVersionUpper; |
140 | |
faff3767 |
141 | /** |
142 | * Define if 2D texture UV coordinates are defined top-down or bottom-up. FALSE by default. |
143 | * |
144 | * Proper rendering requires image texture uploading and UV texture coordinates being consistent, |
145 | * otherwise texture mapping might appear vertically flipped. |
146 | * Historically, OCCT used image library loading images bottom-up, |
147 | * so that applications have to generate UV accordingly (flip V when necessary, V' = 1.0 - V). |
148 | * |
149 | * Graphic driver now compares this flag with image layout reported by Image_PixMap::IsTopDown(), |
150 | * and in case of mismatch applies implicit texture coordinates conversion in GLSL program. |
151 | */ |
152 | Standard_Boolean isTopDownTextureUV; |
153 | |
392ac980 |
154 | public: //! @name flags to activate verbose output |
155 | |
156 | //! Print GLSL program compilation/linkage warnings, if any. OFF by default. |
157 | Standard_Boolean glslWarnings; |
e276548b |
158 | |
c87535af |
159 | //! Suppress redundant messages from debug GL context. ON by default. |
160 | Standard_Boolean suppressExtraMsg; |
161 | |
84e84755 |
162 | //! Print GLSL program source code. OFF by default. |
163 | OpenGl_ShaderProgramDumpLevel glslDumpLevel; |
164 | |
58655684 |
165 | public: //! @name class methods |
166 | |
167 | //! Default constructor - initialize with most optimal values. |
168 | Standard_EXPORT OpenGl_Caps(); |
169 | |
170 | //! Destructor. |
171 | Standard_EXPORT virtual ~OpenGl_Caps(); |
172 | |
173 | //! Copy maker. |
174 | Standard_EXPORT OpenGl_Caps& operator= (const OpenGl_Caps& theCopy); |
175 | |
176 | private: |
177 | |
178 | //! Not implemented |
179 | OpenGl_Caps (const OpenGl_Caps& ); |
180 | |
181 | public: |
182 | |
92efcf78 |
183 | DEFINE_STANDARD_RTTIEXT(OpenGl_Caps,Standard_Transient) // Type definition |
58655684 |
184 | |
185 | }; |
186 | |
187 | DEFINE_STANDARD_HANDLE(OpenGl_Caps, Standard_Transient) |
188 | |
189 | #endif // _OpenGl_Caps_H__ |