diff --git a/Rendering/OpenGL2/vtkOpenGLPolyDataMapper.cxx b/Rendering/OpenGL2/vtkOpenGLPolyDataMapper.cxx index b8166ea187544e7cd94414848b3cc45679b856fc..2ec88b9baf6312795ba37ae2ca68d4e5e666cd32 100644 --- a/Rendering/OpenGL2/vtkOpenGLPolyDataMapper.cxx +++ b/Rendering/OpenGL2/vtkOpenGLPolyDataMapper.cxx @@ -1068,6 +1068,7 @@ void vtkOpenGLPolyDataMapper::ReplaceShaderClip( { std::string VSSource = shaders[vtkShader::Vertex]->GetSource(); std::string FSSource = shaders[vtkShader::Fragment]->GetSource(); + std::string GSSource = shaders[vtkShader::Geometry]->GetSource(); if (this->GetNumberOfClippingPlanes()) { @@ -1079,15 +1080,39 @@ void vtkOpenGLPolyDataMapper::ReplaceShaderClip( numClipPlanes = 6; } - vtkShaderProgram::Substitute(VSSource, "//VTK::Clip::Dec", - "uniform int numClipPlanes;\n" - "uniform vec4 clipPlanes[6];\n" - "varying float clipDistancesVSOutput[6];"); - vtkShaderProgram::Substitute(VSSource, "//VTK::Clip::Impl", - "for (int planeNum = 0; planeNum < numClipPlanes; planeNum++)\n" - " {\n" - " clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);\n" - " }\n"); + // geometry shader impl + if (GSSource.length()) + { + vtkShaderProgram::Substitute(VSSource, "//VTK::Clip::Dec", + "varying vec4 clipVertexMC;"); + vtkShaderProgram::Substitute(VSSource, "//VTK::Clip::Impl", + " clipVertexMC = vertexMC;\n"); + vtkShaderProgram::Substitute(GSSource, + "//VTK::Clip::Dec", + "uniform int numClipPlanes;\n" + "uniform vec4 clipPlanes[6];\n" + "in vec4 clipVertexMC[];\n" + "out float clipDistancesGSOutput[6];"); + vtkShaderProgram::Substitute(GSSource, + "//VTK::Clip::Impl", + "for (int planeNum = 0; planeNum < numClipPlanes; planeNum++)\n" + " {\n" + " clipDistancesGSOutput[planeNum] = dot(clipPlanes[planeNum], clipVertexMC[i]);\n" + " }\n"); + } + else // vertex shader impl + { + vtkShaderProgram::Substitute(VSSource, "//VTK::Clip::Dec", + "uniform int numClipPlanes;\n" + "uniform vec4 clipPlanes[6];\n" + "varying float clipDistancesVSOutput[6];"); + vtkShaderProgram::Substitute(VSSource, "//VTK::Clip::Impl", + "for (int planeNum = 0; planeNum < numClipPlanes; planeNum++)\n" + " {\n" + " clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);\n" + " }\n"); + } + vtkShaderProgram::Substitute(FSSource, "//VTK::Clip::Dec", "uniform int numClipPlanes;\n" "varying float clipDistancesVSOutput[6];"); @@ -1099,6 +1124,7 @@ void vtkOpenGLPolyDataMapper::ReplaceShaderClip( } shaders[vtkShader::Vertex]->SetSource(VSSource); shaders[vtkShader::Fragment]->SetSource(FSSource); + shaders[vtkShader::Geometry]->SetSource(GSSource); } void vtkOpenGLPolyDataMapper::ReplaceShaderNormal( diff --git a/Rendering/OpenGL2/vtkOpenGLTexture.cxx b/Rendering/OpenGL2/vtkOpenGLTexture.cxx index 10cd78543cc8414cb974e845a59ee9bb63a7f6cf..1e553b72689059936f36c27a56cd7f50853d290c 100644 --- a/Rendering/OpenGL2/vtkOpenGLTexture.cxx +++ b/Rendering/OpenGL2/vtkOpenGLTexture.cxx @@ -332,7 +332,7 @@ void vtkOpenGLTexture::Load(vtkRenderer *ren) if (this->Mipmap && levels > 1 && (!this->CubeMap || majorV >= 4)) { - this->TextureObject->SetMinificationFilter(vtkTextureObject::LinearMipmapNearest); + this->TextureObject->SetMinificationFilter(vtkTextureObject::LinearMipmapLinear); this->TextureObject->SetMaxLevel(levels - 1); this->TextureObject->SendParameters(); glGenerateMipmap(this->TextureObject->GetTarget());