]> OCCT Git - occt.git/commitdiff
0031997: Visualization, TKOpenGl - phong shader compilation error with normal texture...
authorkgv <kgv@opencascade.com>
Mon, 14 Dec 2020 21:37:49 +0000 (00:37 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 17 Dec 2020 18:05:06 +0000 (21:05 +0300)
OpenGl_ShaderManager::defaultGlslVersion() now defines GLSL 120 for normal map texture.

src/OpenGl/OpenGl_ShaderManager.cxx

index 3c8f75f89b436827749c07ace70ff178a3839ce6..844101d3cc1086cfaaf740bab78a8daf623a4a07 100644 (file)
@@ -1793,6 +1793,14 @@ int OpenGl_ShaderManager::defaultGlslVersion (const Handle(Graphic3d_ShaderProgr
   }
   else
   {
+    const bool toUseMat2x3 = (theBits & OpenGl_PO_HasTextures) == OpenGl_PO_TextureNormal;
+    if (toUseMat2x3) // TangentSpaceNormal() function uses mat2x3 type
+    {
+      if (myContext->IsGlGreaterEqual (2, 1))
+      {
+        theProgram->SetHeader ("#version 120");
+      }
+    }
     if ((theBits & OpenGl_PO_StippleLine) != 0
      || theProgram->IsPBR())
     {