0027606: Visualization - view is blocking when MSAA has been overridden in graphics...
[occt.git] / src / OpenGl / OpenGl_AspectFace.cxx
1 // Created on: 2011-07-13
2 // Created by: Sergey ZERCHANINOV
3 // Copyright (c) 2011-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
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.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #include <Aspect_PolygonOffsetMode.hxx>
17 #include <NCollection_Vec3.hxx>
18
19 #include <OpenGl_AspectFace.hxx>
20 #include <OpenGl_Context.hxx>
21 #include <OpenGl_ShaderManager.hxx>
22 #include <OpenGl_ShaderProgram.hxx>
23 #include <OpenGl_Texture.hxx>
24 #include <OpenGl_Workspace.hxx>
25
26 #include <Graphic3d_ShaderProgram.hxx>
27 #include <Graphic3d_TextureMap.hxx>
28 #include <Graphic3d_TextureParams.hxx>
29 #include <Graphic3d_TypeOfReflection.hxx>
30 #include <Graphic3d_MaterialAspect.hxx>
31
32 #include <Image_PixMap.hxx>
33
34 namespace
35 {
36   static OPENGL_SURF_PROP THE_DEFAULT_MATERIAL =
37   {
38     0.2F,  0.8F, 0.1F, 0.0F, // amb, diff, spec, emsv
39     1.0F, 10.0F, 1.0F, 0.0F, // trans, shine, index, env_reflexion
40     0, // isphysic
41     (OPENGL_AMBIENT_MASK | OPENGL_DIFFUSE_MASK | OPENGL_SPECULAR_MASK), // color_mask
42     {{ 1.0F, 1.0F, 1.0F, 1.0F }}, // ambient color
43     {{ 1.0F, 1.0F, 1.0F, 1.0F }}, // diffuse color
44     {{ 1.0F, 1.0F, 1.0F, 1.0F }}, // specular color
45     {{ 1.0F, 1.0F, 1.0F, 1.0F }}, // emissive color
46     {{ 1.0F, 1.0F, 1.0F, 1.0F }}, // material color
47     Graphic3d_BSDF()
48   };
49
50   static const TCollection_AsciiString THE_EMPTY_KEY;
51 }
52
53 // =======================================================================
54 // function : convertMaterial
55 // purpose  :
56 // =======================================================================
57 void OpenGl_AspectFace::convertMaterial (const CALL_DEF_MATERIAL& theMat,
58                                          OPENGL_SURF_PROP&        theSurf)
59 {
60   theSurf.amb  = theMat.IsAmbient  ? theMat.Ambient  : 0.0f;
61   theSurf.diff = theMat.IsDiffuse  ? theMat.Diffuse  : 0.0f;
62   theSurf.spec = theMat.IsSpecular ? theMat.Specular : 0.0f;
63   theSurf.emsv = theMat.IsEmission ? theMat.Emission : 0.0f;
64
65   theSurf.isphysic = theMat.IsPhysic ? 1 : 0; // type of material
66
67   // color of material
68   theSurf.color_mask = 0;
69   if (theMat.IsAmbient)
70   {
71     theSurf.color_mask |= OPENGL_AMBIENT_MASK;
72   }
73   if (theMat.IsDiffuse)
74   {
75     theSurf.color_mask |= OPENGL_DIFFUSE_MASK;
76   }
77   if (theMat.IsSpecular)
78   {
79     theSurf.color_mask |= OPENGL_SPECULAR_MASK;
80   }
81   if (theMat.IsEmission)
82   {
83     theSurf.color_mask |= OPENGL_EMISSIVE_MASK;
84   }
85
86   // ambient color
87   theSurf.ambcol.rgb[0] = theMat.ColorAmb.r;
88   theSurf.ambcol.rgb[1] = theMat.ColorAmb.g;
89   theSurf.ambcol.rgb[2] = theMat.ColorAmb.b;
90   theSurf.ambcol.rgb[3] = 1.0f;
91
92   // diffuse color
93   theSurf.difcol.rgb[0] = theMat.ColorDif.r;
94   theSurf.difcol.rgb[1] = theMat.ColorDif.g;
95   theSurf.difcol.rgb[2] = theMat.ColorDif.b;
96   theSurf.difcol.rgb[3] = 1.0f;
97
98   // specular color
99   theSurf.speccol.rgb[0] = theMat.ColorSpec.r;
100   theSurf.speccol.rgb[1] = theMat.ColorSpec.g;
101   theSurf.speccol.rgb[2] = theMat.ColorSpec.b;
102   theSurf.speccol.rgb[3] = 1.0f;
103
104   // emission color
105   theSurf.emscol.rgb[0] = theMat.ColorEms.r;
106   theSurf.emscol.rgb[1] = theMat.ColorEms.g;
107   theSurf.emscol.rgb[2] = theMat.ColorEms.b;
108   theSurf.emscol.rgb[3] = 1.0f;
109
110   theSurf.shine = 128.0f * float(theMat.Shininess);
111   theSurf.env_reflexion = theMat.EnvReflexion;
112
113   // trans = 0. => opaque
114   // trans = 1. => transparent
115   // in OpenGl it is opposite.
116   theSurf.trans = 1.0f - theMat.Transparency;
117   theSurf.index = theMat.RefractionIndex;
118
119   // material BSDF (for physically-based rendering)
120   theSurf.BSDF = theMat.BSDF;
121 }
122
123 // =======================================================================
124 // function : OpenGl_AspectFace
125 // purpose  :
126 // =======================================================================
127 OpenGl_AspectFace::OpenGl_AspectFace()
128 : myInteriorStyle (Aspect_IS_SOLID),
129   myEdge (TOff),
130   myHatch (TEL_HS_SOLID),
131   myDistinguishingMode (TOff),
132   myCullingMode (TelCullNone),
133   myIntFront (THE_DEFAULT_MATERIAL),
134   myIntBack (THE_DEFAULT_MATERIAL),
135   myPolygonOffset (THE_DEFAULT_POFFSET),
136   myDoTextureMap (false)
137 {}
138
139 // =======================================================================
140 // function : SetAspect
141 // purpose  :
142 // =======================================================================
143 void OpenGl_AspectFace::SetAspect (const CALL_DEF_CONTEXTFILLAREA& theAspect)
144 {
145   myInteriorStyle = (Aspect_InteriorStyle )theAspect.Style;
146   myEdge = theAspect.Edge ? TOn : TOff;
147
148   //TelInteriorStyleIndex
149   switch (theAspect.Hatch)
150   {
151     case 0: /* Aspect_HS_HORIZONTAL */
152       myHatch = TEL_HS_HORIZONTAL;
153       break;
154     case 1: /* Aspect_HS_HORIZONTAL_WIDE */
155       myHatch = TEL_HS_HORIZONTAL_SPARSE;
156       break;
157     case 2: /* Aspect_HS_VERTICAL */
158       myHatch = TEL_HS_VERTICAL;
159       break;
160     case 3: /* Aspect_HS_VERTICAL_WIDE */
161       myHatch = TEL_HS_VERTICAL_SPARSE;
162       break;
163     case 4: /* Aspect_HS_DIAGONAL_45 */
164       myHatch = TEL_HS_DIAG_45;
165       break;
166     case 5: /* Aspect_HS_DIAGONAL_45_WIDE */
167       myHatch = TEL_HS_DIAG_45_SPARSE;
168       break;
169     case 6: /* Aspect_HS_DIAGONAL_135 */
170       myHatch = TEL_HS_DIAG_135;
171       break;
172     case 7: /* Aspect_HS_DIAGONAL_135_WIDE */
173       myHatch = TEL_HS_DIAG_135_SPARSE;
174       break;
175     case 8: /* Aspect_HS_GRID */
176       myHatch = TEL_HS_GRID;
177       break;
178     case 9: /* Aspect_HS_GRID_WIDE */
179       myHatch = TEL_HS_GRID_SPARSE;
180       break;
181     case 10: /* Aspect_HS_GRID_DIAGONAL */
182       myHatch = TEL_HS_CROSS;
183       break;
184     case 11: /* Aspect_HS_GRID_DIAGONAL_WIDE */
185       myHatch = TEL_HS_CROSS_SPARSE;
186       break;
187     default:
188       myHatch = 0;
189       break;
190   }
191
192   myDistinguishingMode = theAspect.Distinguish ? TOn : TOff;
193   myCullingMode = theAspect.BackFace ? TelCullBack : TelCullNone;
194
195   convertMaterial (theAspect.Front, myIntFront);
196   convertMaterial (theAspect.Back,  myIntBack);
197
198   //TelInteriorColour
199   myIntFront.matcol.rgb[0] = (float )theAspect.IntColor.r;
200   myIntFront.matcol.rgb[1] = (float )theAspect.IntColor.g;
201   myIntFront.matcol.rgb[2] = (float )theAspect.IntColor.b;
202   myIntFront.matcol.rgb[3] = 1.0f;
203
204   //TelBackInteriorColour
205   myIntBack.matcol.rgb[0] = (float )theAspect.BackIntColor.r;
206   myIntBack.matcol.rgb[1] = (float )theAspect.BackIntColor.g;
207   myIntBack.matcol.rgb[2] = (float )theAspect.BackIntColor.b;
208   myIntBack.matcol.rgb[3] = 1.0f;
209
210   //TelPolygonOffset
211   myPolygonOffset.mode   = (Aspect_PolygonOffsetMode )theAspect.PolygonOffsetMode;
212   myPolygonOffset.factor = theAspect.PolygonOffsetFactor;
213   myPolygonOffset.units  = theAspect.PolygonOffsetUnits;
214
215   CALL_DEF_CONTEXTLINE anEdgeAspect;
216   anEdgeAspect.Color.r  = (float )theAspect.EdgeColor.r;
217   anEdgeAspect.Color.g  = (float )theAspect.EdgeColor.g;
218   anEdgeAspect.Color.b  = (float )theAspect.EdgeColor.b;
219   anEdgeAspect.LineType = (Aspect_TypeOfLine )theAspect.LineType;
220   anEdgeAspect.Width    = (float )theAspect.Width;
221   myAspectEdge.SetAspect (anEdgeAspect);
222
223   myDoTextureMap = (theAspect.Texture.doTextureMap != 0);
224
225   // update texture binding
226   myTexture = theAspect.Texture.TextureMap;
227
228   const TCollection_AsciiString& aTextureKey = myTexture.IsNull() ? THE_EMPTY_KEY : myTexture->GetId();
229   if (aTextureKey.IsEmpty() || myResources.TextureId != aTextureKey)
230   {
231     myResources.ResetTextureReadiness();
232   }
233
234   // update shader program binding
235   myShaderProgram = theAspect.ShaderProgram;
236
237   const TCollection_AsciiString& aShaderKey = myShaderProgram.IsNull() ? THE_EMPTY_KEY : myShaderProgram->GetId();
238   if (aShaderKey.IsEmpty() || myResources.ShaderProgramId != aShaderKey)
239   {
240     myResources.ResetShaderReadiness();
241   }
242 }
243
244 // =======================================================================
245 // function : SetAspect
246 // purpose  :
247 // =======================================================================
248 void OpenGl_AspectFace::SetAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect)
249 {
250   CALL_DEF_CONTEXTFILLAREA aFaceContext;
251   Standard_Real           aWidth;
252   Quantity_Color          aBackIntColor;
253   Quantity_Color          aEdgeColor;
254   Aspect_TypeOfLine       aLType;
255   Quantity_Color          aIntColor;
256   Aspect_InteriorStyle    aIntStyle;
257   NCollection_Vec3<Standard_Real> aColor;
258
259   theAspect->Values (aIntStyle, aIntColor, aBackIntColor, aEdgeColor, aLType, aWidth);
260   aIntColor.Values (aColor.r(), aColor.g(), aColor.b(), Quantity_TOC_RGB);
261
262   aFaceContext.Style      = int (aIntStyle);
263   aFaceContext.IntColor.r = float (aColor.r());
264   aFaceContext.IntColor.g = float (aColor.g());
265   aFaceContext.IntColor.b = float (aColor.b());
266
267   if (theAspect->Distinguish())
268   {
269     aBackIntColor.Values (aColor.r(), aColor.g(), aColor.b(), Quantity_TOC_RGB);
270   }
271
272   aFaceContext.BackIntColor.r = float (aColor.r());
273   aFaceContext.BackIntColor.g = float (aColor.g());
274   aFaceContext.BackIntColor.b = float (aColor.b());
275
276   aFaceContext.Edge = theAspect->Edge () ? 1:0;
277   aEdgeColor.Values (aColor.r(), aColor.g(), aColor.b(), Quantity_TOC_RGB);
278
279   aFaceContext.EdgeColor.r = float (aColor.r());
280   aFaceContext.EdgeColor.g = float (aColor.g());
281   aFaceContext.EdgeColor.b = float (aColor.b());
282   aFaceContext.LineType    = int (aLType);
283   aFaceContext.Width       = float (aWidth);
284   aFaceContext.Hatch       = int (theAspect->HatchStyle ());
285
286   aFaceContext.Distinguish = theAspect->Distinguish () ? 1:0;
287   aFaceContext.BackFace    = theAspect->BackFace ()    ? 1:0;
288
289   aFaceContext.Back.Shininess = float ((theAspect->BackMaterial ()).Shininess ());
290   aFaceContext.Back.Ambient   = float ((theAspect->BackMaterial ()).Ambient ());
291   aFaceContext.Back.Diffuse   = float ((theAspect->BackMaterial ()).Diffuse ());
292   aFaceContext.Back.Specular  = float ((theAspect->BackMaterial ()).Specular ());
293   aFaceContext.Back.Transparency  = float ((theAspect->BackMaterial ()).Transparency ());
294   aFaceContext.Back.Emission      = float ((theAspect->BackMaterial ()).Emissive ());
295
296   // Reflection mode
297   aFaceContext.Back.IsAmbient = ((theAspect->BackMaterial ()).ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0 );
298   aFaceContext.Back.IsDiffuse = ((theAspect->BackMaterial ()).ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0 );
299   aFaceContext.Back.IsSpecular = ((theAspect->BackMaterial ()).ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0 );
300   aFaceContext.Back.IsEmission = ((theAspect->BackMaterial ()).ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0 );
301
302   // Material type
303   const Graphic3d_MaterialAspect aBackMat = theAspect->BackMaterial ();
304   Standard_Boolean isBackPhys = aBackMat.MaterialType (Graphic3d_MATERIAL_PHYSIC);
305   aFaceContext.Back.IsPhysic = (isBackPhys ? 1 : 0 );
306
307   // Specular Color
308   aFaceContext.Back.ColorSpec.r = float (((theAspect->BackMaterial ()).SpecularColor ()).Red ());
309   aFaceContext.Back.ColorSpec.g = float (((theAspect->BackMaterial ()).SpecularColor ()).Green ());
310   aFaceContext.Back.ColorSpec.b = float (((theAspect->BackMaterial ()).SpecularColor ()).Blue ());
311
312   // Ambient color
313   aFaceContext.Back.ColorAmb.r = float (((theAspect->BackMaterial ()).AmbientColor ()).Red ());
314   aFaceContext.Back.ColorAmb.g = float (((theAspect->BackMaterial ()).AmbientColor ()).Green ());
315   aFaceContext.Back.ColorAmb.b = float (((theAspect->BackMaterial ()).AmbientColor ()).Blue ());
316
317   // Diffuse color
318   aFaceContext.Back.ColorDif.r = float (((theAspect->BackMaterial ()).DiffuseColor ()).Red ());
319   aFaceContext.Back.ColorDif.g = float (((theAspect->BackMaterial ()).DiffuseColor ()).Green ());
320   aFaceContext.Back.ColorDif.b = float (((theAspect->BackMaterial ()).DiffuseColor ()).Blue ());
321
322   // Emissive color
323   aFaceContext.Back.ColorEms.r = float (((theAspect->BackMaterial ()).EmissiveColor ()).Red ());
324   aFaceContext.Back.ColorEms.g = float (((theAspect->BackMaterial ()).EmissiveColor ()).Green ());
325   aFaceContext.Back.ColorEms.b = float (((theAspect->BackMaterial ()).EmissiveColor ()).Blue ());
326
327   aFaceContext.Back.EnvReflexion = float ((theAspect->BackMaterial ()).EnvReflexion());
328
329   aFaceContext.Front.Shininess    = float ((theAspect->FrontMaterial ()).Shininess ());
330   aFaceContext.Front.Ambient      = float ((theAspect->FrontMaterial ()).Ambient ());
331   aFaceContext.Front.Diffuse      = float ((theAspect->FrontMaterial ()).Diffuse ());
332   aFaceContext.Front.Specular     = float ((theAspect->FrontMaterial ()).Specular ());
333   aFaceContext.Front.Transparency = float ((theAspect->FrontMaterial ()).Transparency ());
334   aFaceContext.Front.Emission     = float ((theAspect->FrontMaterial ()).Emissive ());
335
336   // Reflection mode
337   aFaceContext.Front.IsAmbient    = ((theAspect->FrontMaterial ()).ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0);
338   aFaceContext.Front.IsDiffuse    = ((theAspect->FrontMaterial ()).ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0);
339   aFaceContext.Front.IsSpecular   = ((theAspect->FrontMaterial ()).ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0);
340   aFaceContext.Front.IsEmission   = ((theAspect->FrontMaterial ()).ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0);
341
342   // Material type
343   const Graphic3d_MaterialAspect aFrontMat = theAspect->FrontMaterial ();
344   Standard_Boolean isFrontPhys = aFrontMat.MaterialType (Graphic3d_MATERIAL_PHYSIC);
345   aFaceContext.Front.IsPhysic = (isFrontPhys ? 1 : 0 );
346
347   // Specular Color
348   aFaceContext.Front.ColorSpec.r = float (((theAspect->FrontMaterial ()).SpecularColor ()).Red ());
349   aFaceContext.Front.ColorSpec.g = float (((theAspect->FrontMaterial ()).SpecularColor ()).Green ());
350   aFaceContext.Front.ColorSpec.b = float (((theAspect->FrontMaterial ()).SpecularColor ()).Blue ());
351
352   // Ambient color
353   aFaceContext.Front.ColorAmb.r = float (((theAspect->FrontMaterial ()).AmbientColor ()).Red ());
354   aFaceContext.Front.ColorAmb.g = float (((theAspect->FrontMaterial ()).AmbientColor ()).Green ());
355   aFaceContext.Front.ColorAmb.b = float (((theAspect->FrontMaterial ()).AmbientColor ()).Blue ());
356
357   // Diffuse color
358   aFaceContext.Front.ColorDif.r = float (((theAspect->FrontMaterial ()).DiffuseColor ()).Red ());
359   aFaceContext.Front.ColorDif.g = float (((theAspect->FrontMaterial ()).DiffuseColor ()).Green ());
360   aFaceContext.Front.ColorDif.b = float (((theAspect->FrontMaterial ()).DiffuseColor ()).Blue ());
361
362   // Emissive color
363   aFaceContext.Front.ColorEms.r = float (((theAspect->FrontMaterial ()).EmissiveColor ()).Red ());
364   aFaceContext.Front.ColorEms.g = float (((theAspect->FrontMaterial ()).EmissiveColor ()).Green ());
365   aFaceContext.Front.ColorEms.b = float (((theAspect->FrontMaterial ()).EmissiveColor ()).Blue ());
366
367   aFaceContext.Front.EnvReflexion = float ((theAspect->FrontMaterial ()).EnvReflexion());
368   aFaceContext.IsDef = 1;
369   aFaceContext.Texture.TextureMap   = theAspect->TextureMap();
370   aFaceContext.Texture.doTextureMap = theAspect->TextureMapState() ? 1 : 0;
371
372   Standard_Integer aPolyMode;
373   Standard_ShortReal aPolyFactor, aPolyUnits;
374   theAspect->PolygonOffsets (aPolyMode, aPolyFactor, aPolyUnits);
375   aFaceContext.PolygonOffsetMode   = aPolyMode;
376   aFaceContext.PolygonOffsetFactor = (Standard_ShortReal)aPolyFactor;
377   aFaceContext.PolygonOffsetUnits  = (Standard_ShortReal)aPolyUnits;
378
379   aFaceContext.ShaderProgram = theAspect->ShaderProgram();
380
381   SetAspect (aFaceContext);
382 }
383
384 // =======================================================================
385 // function : Render
386 // purpose  :
387 // =======================================================================
388 void OpenGl_AspectFace::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
389 {
390   theWorkspace->SetAspectFace (this);
391 }
392
393 // =======================================================================
394 // function : Release
395 // purpose  :
396 // =======================================================================
397 void OpenGl_AspectFace::Release (OpenGl_Context* theContext)
398 {
399   if (!myResources.Texture.IsNull())
400   {
401     if (theContext)
402     {
403       if (myResources.TextureId.IsEmpty())
404       {
405         theContext->DelayedRelease (myResources.Texture);
406       }
407       else
408       {
409         myResources.Texture.Nullify(); // we need nullify all handles before ReleaseResource() call
410         theContext->ReleaseResource (myResources.TextureId, Standard_True);
411       }
412     }
413     myResources.Texture.Nullify();
414   }
415   myResources.TextureId.Clear();
416   myResources.ResetTextureReadiness();
417
418   if (!myResources.ShaderProgram.IsNull()
419    && theContext)
420   {
421     theContext->ShaderManager()->Unregister (myResources.ShaderProgramId,
422                                              myResources.ShaderProgram);
423   }
424   myResources.ShaderProgramId.Clear();
425   myResources.ResetShaderReadiness();
426 }
427
428 // =======================================================================
429 // function : BuildTexture
430 // purpose  :
431 // =======================================================================
432 void OpenGl_AspectFace::Resources::BuildTexture (const Handle(OpenGl_Context)&       theCtx,
433                                                  const Handle(Graphic3d_TextureMap)& theTexture)
434 {
435   // release old texture resource
436   if (!Texture.IsNull())
437   {
438     if (TextureId.IsEmpty())
439     {
440       theCtx->DelayedRelease (Texture);
441       Texture.Nullify();
442     }
443     else
444     {
445       Texture.Nullify(); // we need nullify all handles before ReleaseResource() call
446       theCtx->ReleaseResource (TextureId, Standard_True);
447     }
448   }
449
450   TextureId = theTexture.IsNull() ? THE_EMPTY_KEY : theTexture->GetId();
451
452   if (!theTexture.IsNull())
453   {
454     if (TextureId.IsEmpty() || !theCtx->GetResource<Handle(OpenGl_Texture)> (TextureId, Texture))
455     {
456       Texture = new OpenGl_Texture (theTexture->GetParams());
457       Handle(Image_PixMap) anImage = theTexture->GetImage();
458       if (!anImage.IsNull())
459       {
460         Texture->Init (theCtx, *anImage.operator->(), theTexture->Type());
461       }
462       if (!TextureId.IsEmpty())
463       {
464         theCtx->ShareResource (TextureId, Texture);
465       }
466     }
467   }
468 }
469
470 // =======================================================================
471 // function : BuildShader
472 // purpose  :
473 // =======================================================================
474 void OpenGl_AspectFace::Resources::BuildShader (const Handle(OpenGl_Context)&          theCtx,
475                                                 const Handle(Graphic3d_ShaderProgram)& theShader)
476 {
477   if (theCtx->core20fwd == NULL)
478   {
479     return;
480   }
481
482   // release old shader program resources
483   if (!ShaderProgram.IsNull())
484   {
485     theCtx->ShaderManager()->Unregister (ShaderProgramId, ShaderProgram);
486     ShaderProgramId.Clear();
487     ShaderProgram.Nullify();
488   }
489   if (theShader.IsNull())
490   {
491     return;
492   }
493
494   theCtx->ShaderManager()->Create (theShader, ShaderProgramId, ShaderProgram);
495 }