From: kgv Date: Mon, 14 Dec 2020 21:37:49 +0000 (+0300) Subject: 0031997: Visualization, TKOpenGl - phong shader compilation error with normal texture... X-Git-Tag: V7_6_0_beta~346 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=1e1158c78b040e1f420faaaa02d30fe154697533;p=occt.git 0031997: Visualization, TKOpenGl - phong shader compilation error with normal texture map enabled OpenGl_ShaderManager::defaultGlslVersion() now defines GLSL 120 for normal map texture. --- diff --git a/src/OpenGl/OpenGl_ShaderManager.cxx b/src/OpenGl/OpenGl_ShaderManager.cxx index 3c8f75f89b..844101d3cc 100644 --- a/src/OpenGl/OpenGl_ShaderManager.cxx +++ b/src/OpenGl/OpenGl_ShaderManager.cxx @@ -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()) {