Skip to content

Commit a52687d

Browse files
Add support for closest filtering in GLSL (#2295)
This changelist adds support for the `closest` filter type in GLSL rendering, allowing it to correctly affect the magnification filtering of textures.
1 parent 16d601b commit a52687d

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

source/MaterialXRenderGlsl/GLTextureHandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ bool GLTextureHandler::bindImage(ImagePtr image, const ImageSamplingProperties&
6161

6262
// Set up texture properties
6363
GLint minFilterType = mapFilterTypeToGL(samplingProperties.filterType, samplingProperties.enableMipmaps);
64-
GLint magFilterType = GL_LINEAR; // Magnification filters are more restrictive than minification
64+
GLint magFilterType = mapFilterTypeToGL(samplingProperties.filterType);
6565
GLint uaddressMode = mapAddressModeToGL(samplingProperties.uaddressMode);
6666
GLint vaddressMode = mapAddressModeToGL(samplingProperties.vaddressMode);
6767
Color4 borderColor(samplingProperties.defaultColor);

source/MaterialXRenderGlsl/GLTextureHandler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class MX_RENDERGLSL_API GLTextureHandler : public ImageHandler
5050
static int mapAddressModeToGL(ImageSamplingProperties::AddressMode addressModeEnum);
5151

5252
/// Utility to map a filter type enumeration to an OpenGL filter type
53-
static int mapFilterTypeToGL(ImageSamplingProperties::FilterType filterTypeEnum, bool enableMipmaps);
53+
static int mapFilterTypeToGL(ImageSamplingProperties::FilterType filterTypeEnum, bool enableMipmaps = false);
5454

5555
/// Utility to map generic texture properties to OpenGL texture formats.
5656
static void mapTextureFormatToGL(Image::BaseType baseType, unsigned int channelCount, bool srgb,

0 commit comments

Comments
 (0)