From 1e1158c78b040e1f420faaaa02d30fe154697533 Mon Sep 17 00:00:00 2001 From: kgv Date: Tue, 15 Dec 2020 00:37:49 +0300 Subject: [PATCH] 0031997: Visualization, TKOpenGl - phong shader compilation error with normal texture map enabled OpenGl_ShaderManager::defaultGlslVersion() now defines GLSL 120 for normal map texture. --- src/OpenGl/OpenGl_ShaderManager.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) 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()) {