1 // Created on: 2013-09-19
2 // Created by: Denis BOGOLEPOV
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_ShaderProgram_Header
17 #define _OpenGl_ShaderProgram_Header
19 #include <NCollection_DataMap.hxx>
20 #include <NCollection_Sequence.hxx>
21 #include <TCollection_AsciiString.hxx>
23 #include <Graphic3d_ShaderObject.hxx>
24 #include <Graphic3d_ShaderProgram.hxx>
26 #include <OpenGl_Vec.hxx>
27 #include <OpenGl_Matrix.hxx>
28 #include <OpenGl_NamedResource.hxx>
29 #include <OpenGl_ShaderObject.hxx>
31 class OpenGl_ShaderProgram;
32 DEFINE_STANDARD_HANDLE(OpenGl_ShaderProgram, OpenGl_NamedResource)
34 //! The enumeration of OCCT-specific OpenGL/GLSL variables.
35 enum OpenGl_StateVariable
37 // OpenGL matrix state
38 OpenGl_OCC_MODEL_WORLD_MATRIX,
39 OpenGl_OCC_WORLD_VIEW_MATRIX,
40 OpenGl_OCC_PROJECTION_MATRIX,
41 OpenGl_OCC_MODEL_WORLD_MATRIX_INVERSE,
42 OpenGl_OCC_WORLD_VIEW_MATRIX_INVERSE,
43 OpenGl_OCC_PROJECTION_MATRIX_INVERSE,
44 OpenGl_OCC_MODEL_WORLD_MATRIX_TRANSPOSE,
45 OpenGl_OCC_WORLD_VIEW_MATRIX_TRANSPOSE,
46 OpenGl_OCC_PROJECTION_MATRIX_TRANSPOSE,
47 OpenGl_OCC_MODEL_WORLD_MATRIX_INVERSE_TRANSPOSE,
48 OpenGl_OCC_WORLD_VIEW_MATRIX_INVERSE_TRANSPOSE,
49 OpenGl_OCC_PROJECTION_MATRIX_INVERSE_TRANSPOSE,
51 // OpenGL clip planes state
52 OpenGl_OCC_CLIP_PLANE_EQUATIONS,
53 OpenGl_OCC_CLIP_PLANE_COUNT,
56 OpenGl_OCC_LIGHT_SOURCE_COUNT,
57 OpenGl_OCC_LIGHT_SOURCE_TYPES,
58 OpenGl_OCC_LIGHT_SOURCE_PARAMS,
59 OpenGl_OCC_LIGHT_AMBIENT,
62 OpenGl_OCCT_TEXTURE_ENABLE,
63 OpenGl_OCCT_DISTINGUISH_MODE,
64 OpenGl_OCCT_FRONT_MATERIAL,
65 OpenGl_OCCT_BACK_MATERIAL,
66 OpenGl_OCCT_ALPHA_CUTOFF,
69 // Weighted, Blended Order-Independent Transparency rendering state
70 OpenGl_OCCT_OIT_OUTPUT,
71 OpenGl_OCCT_OIT_DEPTH_FACTOR,
73 // Context-dependent state
74 OpenGl_OCCT_TEXTURE_TRSF2D,
75 OpenGl_OCCT_POINT_SIZE,
77 // DON'T MODIFY THIS ITEM (insert new items before it)
78 OpenGl_OCCT_NUMBER_OF_STATE_VARIABLES
81 //! Interface for generic setter of user-defined uniform variables.
82 struct OpenGl_SetterInterface
84 //! Sets user-defined uniform variable to specified program.
85 virtual void Set (const Handle(OpenGl_Context)& theCtx,
86 const Handle(Graphic3d_ShaderVariable)& theVariable,
87 OpenGl_ShaderProgram* theProgram) = 0;
90 virtual ~OpenGl_SetterInterface() {}
93 //! List of OpenGL shader objects.
94 typedef NCollection_Sequence<Handle(OpenGl_ShaderObject)> OpenGl_ShaderList;
96 //! List of shader variable setters.
97 typedef NCollection_DataMap<size_t, OpenGl_SetterInterface*> OpenGl_SetterList;
99 //! Support tool for setting user-defined uniform variables.
100 class OpenGl_VariableSetterSelector
104 //! Creates new setter selector.
105 OpenGl_VariableSetterSelector();
107 //! Releases memory resources of setter selector.
108 ~OpenGl_VariableSetterSelector();
110 //! Sets user-defined uniform variable to specified program.
111 void Set (const Handle(OpenGl_Context)& theCtx,
112 const Handle(Graphic3d_ShaderVariable)& theVariable,
113 OpenGl_ShaderProgram* theProgram) const;
117 //! List of variable setters.
118 OpenGl_SetterList mySetterList;
121 //! Defines types of uniform state variables.
122 enum OpenGl_UniformStateType
124 OpenGl_LIGHT_SOURCES_STATE,
125 OpenGl_CLIP_PLANES_STATE,
126 OpenGl_MODEL_WORLD_STATE,
127 OpenGl_WORLD_VIEW_STATE,
128 OpenGl_PROJECTION_STATE,
129 OpenGl_MATERIAL_STATE,
130 OpenGl_SURF_DETAIL_STATE,
132 OpenGl_UniformStateType_NB
135 //! Wrapper for OpenGL program object.
136 class OpenGl_ShaderProgram : public OpenGl_NamedResource
138 friend class OpenGl_View;
139 friend class OpenGl_ShaderManager;
140 DEFINE_STANDARD_RTTIEXT(OpenGl_ShaderProgram, OpenGl_NamedResource)
143 //! Non-valid shader name.
144 static const GLuint NO_PROGRAM = 0;
146 //! Invalid location of uniform/attribute variable.
147 static const GLint INVALID_LOCATION = -1;
149 //! List of pre-defined OCCT state uniform variables.
150 static Standard_CString PredefinedKeywords[OpenGl_OCCT_NUMBER_OF_STATE_VARIABLES];
152 //! Creates uninitialized shader program.
154 //! WARNING! This constructor is not intended to be called anywhere but from OpenGl_ShaderManager::Create().
155 //! Manager has been designed to synchronize camera position, lights definition and other aspects of the program implicitly,
156 //! as well as sharing same program across rendering groups.
158 //! Program created outside the manager will be left detached from these routines,
159 //! and them should be performed manually by caller.
161 //! This constructor has been made public to provide more flexibility to re-use OCCT OpenGL classes without OCCT Viewer itself.
162 //! If this is not the case - create the program using shared OpenGl_ShaderManager instance instead.
163 Standard_EXPORT OpenGl_ShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProxy = NULL);
167 static OpenGl_VariableSetterSelector mySetterSelector;
171 //! Releases resources of shader program.
172 Standard_EXPORT virtual ~OpenGl_ShaderProgram();
174 //! Creates new empty shader program of specified type.
175 Standard_EXPORT Standard_Boolean Create (const Handle(OpenGl_Context)& theCtx);
177 //! Destroys shader program.
178 Standard_EXPORT virtual void Release (OpenGl_Context* theCtx) Standard_OVERRIDE;
180 //! Returns estimated GPU memory usage - cannot be easily estimated.
181 virtual Standard_Size EstimatedDataSize() const Standard_OVERRIDE { return 0; }
183 //! Attaches shader object to the program object.
184 Standard_EXPORT Standard_Boolean AttachShader (const Handle(OpenGl_Context)& theCtx,
185 const Handle(OpenGl_ShaderObject)& theShader);
187 //! Detaches shader object to the program object.
188 Standard_EXPORT Standard_Boolean DetachShader (const Handle(OpenGl_Context)& theCtx,
189 const Handle(OpenGl_ShaderObject)& theShader);
191 //! Initializes program object with the list of shader objects.
192 Standard_EXPORT Standard_Boolean Initialize (const Handle(OpenGl_Context)& theCtx,
193 const Graphic3d_ShaderObjectList& theShaders);
195 //! Links the program object.
196 Standard_EXPORT Standard_Boolean Link (const Handle(OpenGl_Context)& theCtx);
198 //! Fetches information log of the last link operation.
199 Standard_EXPORT Standard_Boolean FetchInfoLog (const Handle(OpenGl_Context)& theCtx,
200 TCollection_AsciiString& theLog);
202 //! Fetches uniform variables from proxy shader program.
203 Standard_EXPORT Standard_Boolean ApplyVariables (const Handle(OpenGl_Context)& theCtx);
205 //! @return true if current object was initialized
206 inline bool IsValid() const
208 return myProgramID != NO_PROGRAM;
211 //! @return program ID
212 inline GLuint ProgramId() const
219 //! Return TRUE if program defines tessellation stage.
220 Standard_Boolean HasTessellationStage() const { return myHasTessShader; }
222 //! Return the length of array of light sources (THE_MAX_LIGHTS),
223 //! to be used for initialization occLightSources (OpenGl_OCC_LIGHT_SOURCE_PARAMS).
224 Standard_Integer NbLightsMax() const { return myNbLightsMax; }
226 //! Return the length of array of clipping planes (THE_MAX_CLIP_PLANES),
227 //! to be used for initialization occClipPlaneEquations (OpenGl_OCC_CLIP_PLANE_EQUATIONS).
228 Standard_Integer NbClipPlanesMax() const { return myNbClipPlanesMax; }
230 //! Return the length of array of Fragment Shader outputs (THE_NB_FRAG_OUTPUTS),
231 //! to be used for initialization occFragColorArray/occFragColorN.
232 Standard_Integer NbFragmentOutputs() const { return myNbFragOutputs; }
234 //! Return true if Fragment Shader should perform alpha test; FALSE by default.
235 Standard_Boolean HasAlphaTest() const { return myHasAlphaTest; }
237 //! Return true if Fragment Shader color should output the weighted OIT coverage; FALSE by default.
238 Standard_Boolean HasWeightOitOutput() const { return myHasWeightOitOutput; }
242 //! Returns index of last modification of variables of specified state type.
243 Standard_Size ActiveState (const OpenGl_UniformStateType theType) const
245 return theType < OpenGl_UniformStateType_NB
246 ? myCurrentState[theType]
250 //! Updates index of last modification of variables of specified state type.
251 void UpdateState (const OpenGl_UniformStateType theType,
252 const Standard_Size theIndex)
254 if (theType < OpenGl_UniformStateType_NB)
256 myCurrentState[theType] = theIndex;
262 //! Returns location of the specific uniform variable.
263 Standard_EXPORT GLint GetUniformLocation (const Handle(OpenGl_Context)& theCtx,
264 const GLchar* theName) const;
266 //! Returns index of the generic vertex attribute by variable name.
267 Standard_EXPORT GLint GetAttributeLocation (const Handle(OpenGl_Context)& theCtx,
268 const GLchar* theName) const;
270 //! Returns location of the OCCT state uniform variable.
271 Standard_EXPORT GLint GetStateLocation (const GLuint theVariable) const;
275 //! Returns the value of the integer uniform variable.
276 Standard_EXPORT Standard_Boolean GetUniform (const Handle(OpenGl_Context)& theCtx,
277 const GLchar* theName,
278 OpenGl_Vec4i& theValue) const;
280 Standard_EXPORT Standard_Boolean GetUniform (const Handle(OpenGl_Context)& theCtx,
282 OpenGl_Vec4i& theValue) const;
284 //! Returns the value of the float uniform variable.
285 Standard_EXPORT Standard_Boolean GetUniform (const Handle(OpenGl_Context)& theCtx,
286 const GLchar* theName,
287 OpenGl_Vec4& theValue) const;
289 //! Returns the value of the float uniform variable.
290 Standard_EXPORT Standard_Boolean GetUniform (const Handle(OpenGl_Context)& theCtx,
292 OpenGl_Vec4& theValue) const;
296 //! Returns the integer vertex attribute.
297 Standard_EXPORT Standard_Boolean GetAttribute (const Handle(OpenGl_Context)& theCtx,
298 const GLchar* theName,
299 OpenGl_Vec4i& theValue) const;
301 //! Returns the integer vertex attribute.
302 Standard_EXPORT Standard_Boolean GetAttribute (const Handle(OpenGl_Context)& theCtx,
304 OpenGl_Vec4i& theValue) const;
306 //! Returns the float vertex attribute.
307 Standard_EXPORT Standard_Boolean GetAttribute (const Handle(OpenGl_Context)& theCtx,
308 const GLchar* theName,
309 OpenGl_Vec4& theValue) const;
311 //! Returns the float vertex attribute.
312 Standard_EXPORT Standard_Boolean GetAttribute (const Handle(OpenGl_Context)& theCtx,
314 OpenGl_Vec4& theValue) const;
318 //! Wrapper for glBindAttribLocation()
319 Standard_EXPORT Standard_Boolean SetAttributeName (const Handle(OpenGl_Context)& theCtx,
321 const GLchar* theName);
323 //! Wrapper for glVertexAttrib1f()
324 Standard_EXPORT Standard_Boolean SetAttribute (const Handle(OpenGl_Context)& theCtx,
325 const GLchar* theName,
328 //! Wrapper for glVertexAttrib1f()
329 Standard_EXPORT Standard_Boolean SetAttribute (const Handle(OpenGl_Context)& theCtx,
333 //! Wrapper for glVertexAttrib2fv()
334 Standard_EXPORT Standard_Boolean SetAttribute (const Handle(OpenGl_Context)& theCtx,
335 const GLchar* theName,
336 const OpenGl_Vec2& theValue);
338 //! Wrapper for glVertexAttrib2fv()
339 Standard_EXPORT Standard_Boolean SetAttribute (const Handle(OpenGl_Context)& theCtx,
341 const OpenGl_Vec2& theValue);
343 //! Wrapper for glVertexAttrib3fv()
344 Standard_EXPORT Standard_Boolean SetAttribute (const Handle(OpenGl_Context)& theCtx,
345 const GLchar* theName,
346 const OpenGl_Vec3& theValue);
348 //! Wrapper for glVertexAttrib3fv()
349 Standard_EXPORT Standard_Boolean SetAttribute (const Handle(OpenGl_Context)& theCtx,
351 const OpenGl_Vec3& theValue);
353 //! Wrapper for glVertexAttrib4fv()
354 Standard_EXPORT Standard_Boolean SetAttribute (const Handle(OpenGl_Context)& theCtx,
355 const GLchar* theName,
356 const OpenGl_Vec4& theValue);
358 //! Wrapper for glVertexAttrib4fv()
359 Standard_EXPORT Standard_Boolean SetAttribute (const Handle(OpenGl_Context)& theCtx,
361 const OpenGl_Vec4& theValue);
365 //! Specifies the value of the integer uniform variable.
366 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
367 const GLchar* theName,
370 //! Specifies the value of the integer uniform variable.
371 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
375 //! Specifies the value of the integer uniform 2D vector.
376 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
377 const GLchar* theName,
378 const OpenGl_Vec2i& theValue);
380 //! Specifies the value of the integer uniform 2D vector.
381 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
383 const OpenGl_Vec2i& theValue);
385 //! Specifies the value of the integer uniform 3D vector.
386 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
387 const GLchar* theName,
388 const OpenGl_Vec3i& theValue);
390 //! Specifies the value of the integer uniform 3D vector.
391 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
393 const OpenGl_Vec3i& theValue);
395 //! Specifies the value of the integer uniform 4D vector.
396 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
397 const GLchar* theName,
398 const OpenGl_Vec4i& theValue);
400 //! Specifies the value of the integer uniform 4D vector.
401 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
403 const OpenGl_Vec4i& theValue);
407 //! Specifies the value of the unsigned integer uniform 2D vector (uvec2).
408 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
409 const GLchar* theName,
410 const OpenGl_Vec2u& theValue);
412 //! Specifies the value of the unsigned integer uniform 2D vector (uvec2).
413 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
415 const OpenGl_Vec2u& theValue);
417 //! Specifies the value of the uvec2 uniform array
418 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
419 const GLchar* theName,
420 const GLsizei theCount,
421 const OpenGl_Vec2u* theValue);
423 //! Specifies the value of the uvec2 uniform array
424 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
426 const GLsizei theCount,
427 const OpenGl_Vec2u* theValue);
431 //! Specifies the value of the float uniform variable.
432 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
433 const GLchar* theName,
436 //! Specifies the value of the float uniform variable.
437 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
441 //! Specifies the value of the float uniform 2D vector.
442 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
443 const GLchar* theName,
444 const OpenGl_Vec2& theValue);
446 //! Specifies the value of the float uniform 2D vector.
447 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
449 const OpenGl_Vec2& theValue);
451 //! Specifies the value of the float uniform 3D vector.
452 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
453 const GLchar* theName,
454 const OpenGl_Vec3& theValue);
456 //! Specifies the value of the float uniform 3D vector.
457 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
459 const OpenGl_Vec3& theValue);
461 //! Specifies the value of the float uniform 4D vector.
462 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
463 const GLchar* theName,
464 const OpenGl_Vec4& theValue);
466 //! Specifies the value of the float uniform 4D vector.
467 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
469 const OpenGl_Vec4& theValue);
473 //! Specifies the value of the float uniform 4x4 matrix.
474 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
475 const GLchar* theName,
476 const OpenGl_Mat4& theValue,
477 GLboolean theTranspose = GL_FALSE);
479 //! Specifies the value of the float uniform 4x4 matrix.
480 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
482 const OpenGl_Mat4& theValue,
483 GLboolean theTranspose = GL_FALSE);
485 //! Specifies the value of the float uniform 4x4 matrix.
486 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
487 const GLchar* theName,
488 const OpenGl_Matrix& theValue,
489 GLboolean theTranspose = GL_FALSE);
491 //! Specifies the value of the float uniform 4x4 matrix.
492 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
494 const OpenGl_Matrix& theValue,
495 GLboolean theTranspose = GL_FALSE);
497 //! Specifies the value of the float uniform array
498 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
501 const Standard_ShortReal* theData);
503 //! Specifies the value of the float2 uniform array
504 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
507 const OpenGl_Vec2* theData);
509 //! Specifies the value of the float3 uniform array
510 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
513 const OpenGl_Vec3* theData);
515 //! Specifies the value of the float4 uniform array
516 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
519 const OpenGl_Vec4* theData);
521 //! Specifies the value of the integer uniform array
522 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
525 const Standard_Integer* theData);
527 //! Specifies the value of the int2 uniform array
528 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
531 const OpenGl_Vec2i* theData);
533 //! Specifies the value of the int3 uniform array
534 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
537 const OpenGl_Vec3i* theData);
539 //! Specifies the value of the int4 uniform array
540 Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
543 const OpenGl_Vec4i* theData);
547 //! Specifies the value of the sampler uniform variable.
548 Standard_EXPORT Standard_Boolean SetSampler (const Handle(OpenGl_Context)& theCtx,
549 const GLchar* theName,
550 const Graphic3d_TextureUnit theTextureUnit);
552 //! Specifies the value of the sampler uniform variable.
553 Standard_EXPORT Standard_Boolean SetSampler (const Handle(OpenGl_Context)& theCtx,
555 const Graphic3d_TextureUnit theTextureUnit);
559 //! Increments counter of users.
560 //! Used by OpenGl_ShaderManager.
561 //! @return true when resource has been restored from delayed release queue
564 return ++myShareCount == 1;
567 //! Decrements counter of users.
568 //! Used by OpenGl_ShaderManager.
569 //! @return true when there are no more users of this program has been left
572 return --myShareCount == 0;
577 GLuint myProgramID; //!< Handle of OpenGL shader program
578 OpenGl_ShaderList myShaderObjects; //!< List of attached shader objects
579 Handle(Graphic3d_ShaderProgram) myProxy; //!< Proxy shader program (from application layer)
580 Standard_Integer myShareCount; //!< program users count, initialized with 1 (already shared by one user)
581 Standard_Integer myNbLightsMax; //!< length of array of light sources (THE_MAX_LIGHTS)
582 Standard_Integer myNbClipPlanesMax; //!< length of array of clipping planes (THE_MAX_CLIP_PLANES)
583 Standard_Integer myNbFragOutputs; //!< length of array of Fragment Shader outputs (THE_NB_FRAG_OUTPUTS)
584 Standard_Boolean myHasAlphaTest; //!< flag indicating that Fragment Shader should perform alpha-test
585 Standard_Boolean myHasWeightOitOutput; //!< flag indicating that Fragment Shader includes weighted OIT coverage
586 Standard_Boolean myHasTessShader; //!< flag indicating that program defines tessellation stage
590 Standard_Size myCurrentState[OpenGl_UniformStateType_NB]; //!< defines last modification for variables of each state type
592 //! Stores locations of OCCT state uniform variables.
593 GLint myStateLocations[OpenGl_OCCT_NUMBER_OF_STATE_VARIABLES];
598 struct OpenGl_VariableSetter : public OpenGl_SetterInterface
600 virtual void Set (const Handle(OpenGl_Context)& theCtx,
601 const Handle(Graphic3d_ShaderVariable)& theVariable,
602 OpenGl_ShaderProgram* theProgram)
604 theProgram->SetUniform (theCtx,
605 theVariable->Name().ToCString(),
606 theVariable->Value()->As<T>());
610 namespace OpenGl_HashMapInitializer
612 template<class K, class V>
615 NCollection_DataMap<K, V> myDictionary;
617 MapListOfType (K theKey, V theValue)
619 myDictionary.Bind (theKey, theValue);
622 MapListOfType& operator() (K theKey, V theValue)
624 myDictionary.Bind (theKey, theValue);
628 operator const NCollection_DataMap<K, V>& () const
634 template<class K, class V>
635 MapListOfType<K, V> CreateListOf (K theKey, V theValue)
637 return MapListOfType<K, V> (theKey, theValue);
641 #endif // _OpenGl_ShaderProgram_Header