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