0024742: Remove rarely used collection classes: Queue
[occt.git] / src / OpenGl / OpenGl_Context.hxx
CommitLineData
6aca4d39 1// Created on: 2012-01-26
b311480e 2// Created by: Kirill GAVRILOV
6aca4d39 3// Copyright (c) 2012-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
2166f0fa
SK
16#ifndef _OpenGl_Context_H__
17#define _OpenGl_Context_H__
18
2bd4c032 19#include <Aspect_Handle.hxx>
20#include <Aspect_Drawable.hxx>
21#include <Aspect_Display.hxx>
22#include <Aspect_RenderingContext.hxx>
5e27df78 23#include <Handle_OpenGl_Context.hxx>
30f0ad28 24#include <Handle_OpenGl_ShaderManager.hxx>
5e27df78 25#include <NCollection_DataMap.hxx>
4269bd1b 26#include <NCollection_Map.hxx>
5e27df78 27#include <NCollection_Handle.hxx>
3125ebb6 28#include <NCollection_List.hxx>
cbf18624 29#include <Message.hxx>
58655684 30#include <OpenGl_Caps.hxx>
5e27df78 31#include <OpenGl_Resource.hxx>
2166f0fa 32#include <Standard_Transient.hxx>
f0430952 33#include <TCollection_AsciiString.hxx>
2166f0fa 34#include <Handle_OpenGl_Context.hxx>
30f0ad28 35#include <OpenGl_Clipping.hxx>
b5ac8292 36#include <OpenGl_GlCore11.hxx>
2166f0fa 37
5f8b738e 38//! Forward declarations
01ca42b2 39struct OpenGl_GlFunctions;
5e27df78 40struct OpenGl_ArbTBO;
41struct OpenGl_ArbIns;
58655684 42struct OpenGl_ArbDbg;
01ca42b2 43struct OpenGl_ArbFBO;
37eb4787 44struct OpenGl_ExtGS;
2166f0fa 45
01ca42b2 46template<typename theBaseClass_t> struct OpenGl_TmplCore12;
47typedef OpenGl_TmplCore12<OpenGl_GlCore11> OpenGl_GlCore12;
48typedef OpenGl_TmplCore12<OpenGl_GlCore11Fwd> OpenGl_GlCore12Fwd;
49
50struct OpenGl_GlCore13;
51struct OpenGl_GlCore13Fwd;
52
53template<typename theBaseClass_t> struct OpenGl_TmplCore14;
54typedef OpenGl_TmplCore14<OpenGl_GlCore13> OpenGl_GlCore14;
55typedef OpenGl_TmplCore14<OpenGl_GlCore13Fwd> OpenGl_GlCore14Fwd;
56
57template<typename theBaseClass_t> struct OpenGl_TmplCore15;
58typedef OpenGl_TmplCore15<OpenGl_GlCore14> OpenGl_GlCore15;
59typedef OpenGl_TmplCore15<OpenGl_GlCore14Fwd> OpenGl_GlCore15Fwd;
60
61template<typename theBaseClass_t> struct OpenGl_TmplCore20;
62typedef OpenGl_TmplCore20<OpenGl_GlCore15> OpenGl_GlCore20;
63typedef OpenGl_TmplCore20<OpenGl_GlCore15Fwd> OpenGl_GlCore20Fwd;
64
65template<typename theBaseClass_t> struct OpenGl_TmplCore21;
66typedef OpenGl_TmplCore21<OpenGl_GlCore20> OpenGl_GlCore21;
67typedef OpenGl_TmplCore21<OpenGl_GlCore20Fwd> OpenGl_GlCore21Fwd;
68
69template<typename theBaseClass_t> struct OpenGl_TmplCore30;
70typedef OpenGl_TmplCore30<OpenGl_GlCore21> OpenGl_GlCore30;
71typedef OpenGl_TmplCore30<OpenGl_GlCore21Fwd> OpenGl_GlCore30Fwd;
72
73template<typename theBaseClass_t> struct OpenGl_TmplCore31;
74typedef OpenGl_TmplCore31<OpenGl_GlCore30> OpenGl_GlCore31Back;
75typedef OpenGl_TmplCore31<OpenGl_GlCore30Fwd> OpenGl_GlCore31;
76
77template<typename theBaseClass_t> struct OpenGl_TmplCore32;
78typedef OpenGl_TmplCore32<OpenGl_GlCore31Back> OpenGl_GlCore32Back;
79typedef OpenGl_TmplCore32<OpenGl_GlCore31> OpenGl_GlCore32;
80
81template<typename theBaseClass_t> struct OpenGl_TmplCore33;
82typedef OpenGl_TmplCore33<OpenGl_GlCore32Back> OpenGl_GlCore33Back;
83typedef OpenGl_TmplCore33<OpenGl_GlCore32> OpenGl_GlCore33;
84
85template<typename theBaseClass_t> struct OpenGl_TmplCore40;
86typedef OpenGl_TmplCore40<OpenGl_GlCore33Back> OpenGl_GlCore40Back;
87typedef OpenGl_TmplCore40<OpenGl_GlCore33> OpenGl_GlCore40;
88
89template<typename theBaseClass_t> struct OpenGl_TmplCore41;
90typedef OpenGl_TmplCore41<OpenGl_GlCore40Back> OpenGl_GlCore41Back;
91typedef OpenGl_TmplCore41<OpenGl_GlCore40> OpenGl_GlCore41;
92
93template<typename theBaseClass_t> struct OpenGl_TmplCore42;
94typedef OpenGl_TmplCore42<OpenGl_GlCore41Back> OpenGl_GlCore42Back;
95typedef OpenGl_TmplCore42<OpenGl_GlCore41> OpenGl_GlCore42;
96
97template<typename theBaseClass_t> struct OpenGl_TmplCore43;
98typedef OpenGl_TmplCore43<OpenGl_GlCore42Back> OpenGl_GlCore43Back;
99typedef OpenGl_TmplCore43<OpenGl_GlCore42> OpenGl_GlCore43;
100
101template<typename theBaseClass_t> struct OpenGl_TmplCore44;
102typedef OpenGl_TmplCore44<OpenGl_GlCore43Back> OpenGl_GlCore44Back;
103typedef OpenGl_TmplCore44<OpenGl_GlCore43> OpenGl_GlCore44;
104
5f8b738e 105//! This class generalize access to the GL context and available extensions.
106//!
107//! Functions are grouped into structures and accessed as fields.
108//! You should check the group for NULL before usage (if group is not NULL
109//! then all functions are available):
110//! @code
111//! if (myContext->core20 != NULL)
112//! {
113//! myGlProgram = myContext->core20->glCreateProgram();
114//! .. do more stuff ..
115//! }
116//! else
117//! {
118//! .. compatibility with outdated configurations ..
119//! }
120//! @endcode
121//!
122//! Current implementation provide access to OpenGL core functionality up to 2.0 version
123//! (core12, core13, core14, core15, fields core20).
01ca42b2 124//! within several extensions (arbTBO, arbFBO, etc.).
5f8b738e 125//!
126//! Simplified extensions classification:
127//! - prefixed with NV, AMD, ATI are vendor-specific (however may be provided by other vendors in some cases);
128//! - prefixed with EXT are accepted by 2+ vendors;
129//! - prefixed with ARB are accepted by Architecture Review Board and are candidates
130//! for inclusion into GL core functionality.
131//! Some functionality can be represented in several extensions simultaneously.
132//! In this case developer should be careful because different specification may differ
133//! in aspects (like enumeration values and error-handling).
134//!
135//! Notice that some systems provide mechanisms to simultaneously incorporate with GL contexts
136//! with different capabilities. Thats why OpenGl_Context should be initialized and used
137//! for each GL context individually.
2166f0fa
SK
138class OpenGl_Context : public Standard_Transient
139{
a174a3c5 140public:
141
142 //! Function for getting power of to number larger or equal to input number.
143 //! @param theNumber number to 'power of two'
144 //! @param theThreshold upper threshold
145 //! @return power of two number
146 inline static Standard_Integer GetPowerOfTwo (const Standard_Integer theNumber,
147 const Standard_Integer theThreshold)
148 {
149 for (Standard_Integer p2 = 2; p2 <= theThreshold; p2 <<= 1)
150 {
151 if (theNumber <= p2)
152 {
153 return p2;
154 }
155 }
156 return theThreshold;
157 }
158
2166f0fa
SK
159public:
160
5f8b738e 161 //! Empty constructor. You should call Init() to perform initialization with bound GL context.
58655684 162 Standard_EXPORT OpenGl_Context (const Handle(OpenGl_Caps)& theCaps = NULL);
5f8b738e 163
164 //! Destructor.
165 Standard_EXPORT virtual ~OpenGl_Context();
2166f0fa 166
5e27df78 167 //! Share GL context resources.
168 //! theShareCtx - handle to context to retrieve handles to shared resources.
169 Standard_EXPORT void Share (const Handle(OpenGl_Context)& theShareCtx);
170
7e7c2f0b 171 //! Initialize class from currently bound OpenGL context. Method should be called only once.
172 //! @return false if no GL context is bound to the current thread
f0430952 173 Standard_EXPORT Standard_Boolean Init();
2166f0fa 174
fd4a6963 175 //! @return true if this context is valid (has been initialized)
176 inline Standard_Boolean IsValid() const
177 {
178 return myIsInitialized;
179 }
180
58655684 181#if defined(_WIN32)
7e7c2f0b 182 //! Initialize class from specified window and rendering context. Method should be called only once.
183 //! @return false if OpenGL context can not be bound to specified window
f0430952 184 Standard_EXPORT Standard_Boolean Init (const Aspect_Handle theWindow,
185 const Aspect_Handle theWindowDC,
186 const Aspect_RenderingContext theGContext);
7e7c2f0b 187
188 //! @return the window handle (HWND) currently bound to this OpenGL context
189 inline Aspect_Handle Window() const
190 {
191 return myWindow;
192 }
193
4fe56619 194#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
7e7c2f0b 195 //! Initialize class from specified OpenGL context (NSOpenGLContext). Method should be called only once.
4fe56619 196 Standard_EXPORT Standard_Boolean Init (const void* theGContext);
2bd4c032 197#else
7e7c2f0b 198 //! Initialize class from specified window and rendering context. Method should be called only once.
199 //! @return false if OpenGL context can not be bound to specified window
f0430952 200 Standard_EXPORT Standard_Boolean Init (const Aspect_Drawable theWindow,
201 const Aspect_Display theDisplay,
202 const Aspect_RenderingContext theGContext);
7e7c2f0b 203
204 //! @return the window handle (GLXDrawable) currently bound to this OpenGL context
205 inline Aspect_Drawable Window() const
206 {
207 return myWindow;
208 }
2bd4c032 209#endif
210
5f8b738e 211 //! Check if theExtName extension is supported by active GL context.
2bd4c032 212 Standard_EXPORT Standard_Boolean CheckExtension (const char* theExtName) const;
2166f0fa 213
58655684 214 //! Check if theExtName extension is in extensions string.
215 Standard_EXPORT static Standard_Boolean CheckExtension (const char* theExtString,
216 const char* theExtName);
217
2166f0fa 218 //! Auxiliary template to retrieve GL function pointer.
5f8b738e 219 //! Pointer to function retrieved from library is statically casted
220 //! to requested type - there no way to check real signature of exported function.
2166f0fa
SK
221 //! The context should be bound before call.
222 template <typename FuncType_t>
5f8b738e 223 Standard_Boolean FindProc (const char* theFuncName,
224 FuncType_t& theFuncPtr)
2166f0fa 225 {
5f8b738e 226 theFuncPtr = (FuncType_t )findProc (theFuncName);
2166f0fa
SK
227 return (theFuncPtr != NULL);
228 }
229
2bd4c032 230 //! @return true if detected GL version is greater or equal to requested one.
231 inline Standard_Boolean IsGlGreaterEqual (const Standard_Integer theVerMajor,
7e7c2f0b 232 const Standard_Integer theVerMinor) const
5f8b738e 233 {
234 return (myGlVerMajor > theVerMajor)
235 || (myGlVerMajor == theVerMajor && myGlVerMinor >= theVerMinor);
236 }
237
238 //! Clean up errors stack for this GL context (glGetError() in loop).
239 Standard_EXPORT void ResetErrors();
240
86fa64d9 241 //! This method uses system-dependent API to retrieve information
242 //! about GL context bound to the current thread.
243 //! @return true if current thread is bound to this GL context
244 Standard_EXPORT Standard_Boolean IsCurrent() const;
245
2bd4c032 246 //! Activates current context.
247 //! Class should be initialized with appropriate info.
248 Standard_EXPORT Standard_Boolean MakeCurrent();
249
5e27df78 250 //! Swap front/back buffers for this GL context (should be activated before!).
251 Standard_EXPORT void SwapBuffers();
252
b5ac8292 253 //! Return true if active mode is GL_RENDER (cached state)
254 Standard_Boolean IsRender() const
255 {
256 return myRenderMode == GL_RENDER;
257 }
664cae74 258
b5ac8292 259 //! Return true if active mode is GL_FEEDBACK (cached state)
260 Standard_Boolean IsFeedback() const
261 {
262 return myRenderMode == GL_FEEDBACK;
263 }
664cae74 264
f0430952 265 //! This function retrieves information from GL about free GPU memory that is:
266 //! - OS-dependent. On some OS it is per-process and on others - for entire system.
267 //! - Vendor-dependent. Currently available only on NVIDIA and AMD/ATi drivers only.
268 //! - Numbers meaning may vary.
269 //! You should use this info only for diagnostics purposes.
270 //! @return free GPU dedicated memory in bytes.
271 Standard_EXPORT Standard_Size AvailableMemory() const;
272
273 //! This function retrieves information from GL about GPU memory
274 //! and contains more vendor-specific values than AvailableMemory().
275 Standard_EXPORT TCollection_AsciiString MemoryInfo() const;
276
5e27df78 277 //! Access shared resource by its name.
278 //! @param theKey - unique identifier;
279 //! @return handle to shared resource or NULL.
280 Standard_EXPORT const Handle(OpenGl_Resource)& GetResource (const TCollection_AsciiString& theKey) const;
281
282 //! Access shared resource by its name.
283 //! @param theKey - unique identifier;
284 //! @param theValue - handle to fill;
285 //! @return true if resource was shared.
286 template<typename TheHandleType>
287 Standard_Boolean GetResource (const TCollection_AsciiString& theKey,
288 TheHandleType& theValue) const
289 {
290 const Handle(OpenGl_Resource)& aResource = GetResource (theKey);
291 if (aResource.IsNull())
292 {
293 return Standard_False;
294 }
295
296 theValue = TheHandleType::DownCast (aResource);
297 return !theValue.IsNull();
298 }
299
300 //! Register shared resource.
301 //! Notice that after registration caller shouldn't release it by himself -
302 //! it will be automatically released on context destruction.
303 //! @param theKey - unique identifier, shouldn't be empty;
304 //! @param theResource - new resource to register, shouldn't be NULL.
305 Standard_EXPORT Standard_Boolean ShareResource (const TCollection_AsciiString& theKey,
306 const Handle(OpenGl_Resource)& theResource);
307
308 //! Release shared resource.
309 //! If there are more than one reference to this resource
310 //! (also used by some other existing object) then call will be ignored.
311 //! This means that current object itself should nullify handle before this call.
312 //! Notice that this is unrecommended operation at all and should be used
313 //! only in case of fat resources to release memory for other needs.
a174a3c5 314 //! @param theKey unique identifier
315 //! @param theToDelay postpone release until next redraw call
316 Standard_EXPORT void ReleaseResource (const TCollection_AsciiString& theKey,
317 const Standard_Boolean theToDelay = Standard_False);
5e27df78 318
319 //! Append resource to queue for delayed clean up.
320 //! Resources in this queue will be released at next redraw call.
321 Standard_EXPORT void DelayedRelease (Handle(OpenGl_Resource)& theResource);
322
323 //! Clean up the delayed release queue.
324 Standard_EXPORT void ReleaseDelayed();
325
4269bd1b 326 //! @return tool for management of clippings within this context.
30f0ad28 327 inline OpenGl_Clipping& ChangeClipping() { return myClippingState; }
4269bd1b 328
329 //! @return tool for management of clippings within this context.
30f0ad28 330 inline const OpenGl_Clipping& Clipping() const { return myClippingState; }
331
332 //! @return tool for management of shader programs within this context.
333 inline const Handle(OpenGl_ShaderManager)& ShaderManager() const { return myShaderManager; }
4269bd1b 334
335public:
336
bf75be98 337 //! @return maximum degree of anisotropy texture filter
338 Standard_EXPORT Standard_Integer MaxDegreeOfAnisotropy() const;
339
340 //! @return value for GL_MAX_TEXTURE_SIZE
341 Standard_EXPORT Standard_Integer MaxTextureSize() const;
342
4269bd1b 343 //! Get maximum number of clip planes supported by OpenGl.
7e7c2f0b 344 //! This value is implementation dependent. At least 6
4269bd1b 345 //! planes should be supported by OpenGl (see specs).
346 //! @return value for GL_MAX_CLIP_PLANES
347 Standard_EXPORT Standard_Integer MaxClipPlanes() const;
348
cbf18624 349public:
350
7e7c2f0b 351 //! @return messenger instance
857ffd5e 352 inline const Handle(Message_Messenger)& Messenger() const
cbf18624 353 {
8fa64b52 354 return ::Message::DefaultMessenger();
cbf18624 355 }
356
357 //! Callback for GL_ARB_debug_output extension
358 //! @param theSource message source within GL_DEBUG_SOURCE_ enumeration
359 //! @param theType message type within GL_DEBUG_TYPE_ enumeration
360 //! @param theId message ID within source
361 //! @param theSeverity message severity within GL_DEBUG_SEVERITY_ enumeration
362 //! @param theMessage the message itself
363 Standard_EXPORT void PushMessage (const unsigned int theSource,
364 const unsigned int theType,
365 const unsigned int theId,
366 const unsigned int theSeverity,
367 const TCollection_ExtendedString& theMessage);
368
b5ac8292 369
370
371 //! @return true if OpenGl context supports left and
372 //! right rendering buffers.
373 Standard_Boolean HasStereoBuffers() const
374 {
375 return myIsStereoBuffers;
376 }
377
378 //! Switch to left stereographic rendering buffer.
379 //! This method can be used to keep unchanged choise
380 //! of front/back/both buffer rendering.
381 Standard_EXPORT void SetDrawBufferLeft();
382
383 //! Switch to right stereographic rendering buffer.
384 //! This method can be used to keep unchanged choise
385 //! of front/back/both buffer rendering.
386 Standard_EXPORT void SetDrawBufferRight();
387
388 //! Switch to non-stereographic rendering buffer.
389 //! This method can be used to keep unchanged choise
390 //! of front/back/both buffer rendering.
391 Standard_EXPORT void SetDrawBufferMono();
392
393 //! Fetch OpenGl context state. This class tracks value of several OpenGl
394 //! state variables. Consulting the cached values is quicker than
395 //! doing the same via OpenGl API. Call this method if any of the controlled
396 //! OpenGl state variables has a possibility of being out-of-date.
397 Standard_EXPORT void FetchState();
398
5f8b738e 399private:
400
401 //! Wrapper to system function to retrieve GL function pointer by name.
402 Standard_EXPORT void* findProc (const char* theFuncName);
403
404 //! Read OpenGL version information from active context.
405 Standard_EXPORT void readGlVersion();
406
407 //! Private initialization function that should be called only once.
408 Standard_EXPORT void init();
409
01ca42b2 410public: //! @name core profiles
411
412 OpenGl_GlCore11* core11; //!< OpenGL 1.1 core functionality
413 OpenGl_GlCore11Fwd* core11fwd; //!< OpenGL 1.1 without deprecated entry points
414 OpenGl_GlCore15* core15; //!< OpenGL 1.5 core functionality
415 OpenGl_GlCore15Fwd* core15fwd; //!< OpenGL 1.5 without deprecated entry points
416 OpenGl_GlCore20* core20; //!< OpenGL 2.0 core functionality (includes 1.5)
417 OpenGl_GlCore20Fwd* core20fwd; //!< OpenGL 2.0 without deprecated entry points
418 OpenGl_GlCore32* core32; //!< OpenGL 3.2 core profile
419 OpenGl_GlCore32Back* core32back; //!< OpenGL 3.2 backward compatibility profile
420 OpenGl_GlCore41* core41; //!< OpenGL 4.1 core profile
421 OpenGl_GlCore41Back* core41back; //!< OpenGL 4.1 backward compatibility profile
422 OpenGl_GlCore42* core42; //!< OpenGL 4.2 core profile
423 OpenGl_GlCore42Back* core42back; //!< OpenGL 4.2 backward compatibility profile
424 OpenGl_GlCore43* core43; //!< OpenGL 4.3 core profile
425 OpenGl_GlCore43Back* core43back; //!< OpenGL 4.3 backward compatibility profile
426 OpenGl_GlCore44* core44; //!< OpenGL 4.4 core profile
427 OpenGl_GlCore44Back* core44back; //!< OpenGL 4.4 backward compatibility profile
5f8b738e 428
58655684 429 Handle(OpenGl_Caps) caps; //!< context options
430
01ca42b2 431public: //! @name extensions
5f8b738e 432
bf75be98 433 Standard_Boolean arbNPTW; //!< GL_ARB_texture_non_power_of_two
01ca42b2 434 Standard_Boolean arbTexRG;//!< GL_ARB_texture_rg
bf75be98 435 OpenGl_ArbTBO* arbTBO; //!< GL_ARB_texture_buffer_object
436 OpenGl_ArbIns* arbIns; //!< GL_ARB_draw_instanced
58655684 437 OpenGl_ArbDbg* arbDbg; //!< GL_ARB_debug_output
01ca42b2 438 OpenGl_ArbFBO* arbFBO; //!< GL_ARB_framebuffer_object
bf75be98 439 OpenGl_ExtGS* extGS; //!< GL_EXT_geometry_shader4
440 Standard_Boolean extBgra; //!< GL_EXT_bgra
441 Standard_Boolean extAnis; //!< GL_EXT_texture_filter_anisotropic
b859a34d 442 Standard_Boolean extPDS; //!< GL_EXT_packed_depth_stencil
bf75be98 443 Standard_Boolean atiMem; //!< GL_ATI_meminfo
444 Standard_Boolean nvxMem; //!< GL_NVX_gpu_memory_info
5f8b738e 445
5e27df78 446private: // system-dependent fields
2166f0fa 447
58655684 448#if defined(_WIN32)
2bd4c032 449 Aspect_Handle myWindow; //!< window handle (owner of GL context) : HWND
450 Aspect_Handle myWindowDC; //!< Device Descriptor handle : HDC
451 Aspect_RenderingContext myGContext; //!< Rendering Context handle : HGLRC
4fe56619 452#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
453 void* myGContext; //!< Rendering Context handle : NSOpenGLContext
2bd4c032 454#else
455 Aspect_Drawable myWindow; //!< window handle (owner of GL context) : GLXDrawable
456 Aspect_Display myDisplay; //!< connection to the X-server : Display*
457 Aspect_RenderingContext myGContext; //!< X-GLX rendering context : GLXContext
458#endif
459
5e27df78 460private: // context info
461
a174a3c5 462 typedef NCollection_DataMap<TCollection_AsciiString, Standard_Integer> OpenGl_DelayReleaseMap;
463 typedef NCollection_Handle<OpenGl_DelayReleaseMap> Handle(OpenGl_DelayReleaseMap);
5e27df78 464 typedef NCollection_DataMap<TCollection_AsciiString, Handle(OpenGl_Resource)> OpenGl_ResourcesMap;
465 typedef NCollection_Handle<OpenGl_ResourcesMap> Handle(OpenGl_ResourcesMap);
3125ebb6 466 typedef NCollection_List<Handle(OpenGl_Resource)> OpenGl_ResourcesStack;
467 typedef NCollection_Handle<OpenGl_ResourcesStack> Handle(OpenGl_ResourcesStack);
5e27df78 468
a174a3c5 469 Handle(OpenGl_ResourcesMap) mySharedResources; //!< shared resources with unique identification key
470 Handle(OpenGl_DelayReleaseMap) myDelayed; //!< shared resources for delayed release
3125ebb6 471 Handle(OpenGl_ResourcesStack) myUnusedResources; //!< stack of resources for delayed clean up
5e27df78 472
30f0ad28 473 OpenGl_Clipping myClippingState; //!< state of clip planes
4269bd1b 474
b5ac8292 475 void* myGlLibHandle; //!< optional handle to GL library
01ca42b2 476 NCollection_Handle<OpenGl_GlFunctions>
477 myFuncs; //!< mega structure for all GL functions
b5ac8292 478 Standard_Integer myAnisoMax; //!< maximum level of anisotropy texture filter
479 Standard_Integer myMaxTexDim; //!< value for GL_MAX_TEXTURE_SIZE
480 Standard_Integer myMaxClipPlanes; //!< value for GL_MAX_CLIP_PLANES
481 Standard_Integer myGlVerMajor; //!< cached GL version major number
482 Standard_Integer myGlVerMinor; //!< cached GL version minor number
483 Standard_Integer myRenderMode; //!< value for active rendering mode
484 Standard_Boolean myIsInitialized; //!< flag indicates initialization state
485 Standard_Boolean myIsStereoBuffers; //!< context supports stereo buffering
486 Standard_Integer myDrawBuffer; //!< current draw buffer.
2166f0fa 487
30f0ad28 488 Handle(OpenGl_ShaderManager) myShaderManager; //! support object for managing shader programs
489
5e27df78 490private:
491
492 //! Copying allowed only within Handles
493 OpenGl_Context (const OpenGl_Context& );
494 OpenGl_Context& operator= (const OpenGl_Context& );
495
2166f0fa
SK
496public:
497
5f8b738e 498 DEFINE_STANDARD_RTTI(OpenGl_Context) // Type definition
2166f0fa 499
5e27df78 500 friend class OpenGl_Window;
501
2166f0fa
SK
502};
503
504#endif // _OpenGl_Context_H__