From 713d6fc357802ed1bbbd657e1b613ebf941a8c32 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Tue, 16 Mar 2021 22:13:53 +0000 Subject: [PATCH] Check GL_NV_framebuffer_multisample_coverage `isRenderbufferMultisampleCoverageSupported()` should not return true if the extension is not supported. Fixes #1028 --- examples/osgfpdepth/osgfpdepth.cpp | 4 +--- src/osg/GLExtensions.cpp | 5 ++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/osgfpdepth/osgfpdepth.cpp b/examples/osgfpdepth/osgfpdepth.cpp index 9dabd4e90..f8c057b45 100644 --- a/examples/osgfpdepth/osgfpdepth.cpp +++ b/examples/osgfpdepth/osgfpdepth.cpp @@ -138,9 +138,7 @@ void getPossibleConfigs(GraphicsContext* gc, BufferConfigList& colorConfigs, return; if (ext->isMultisampleSupported) glGetIntegerv(GL_MAX_SAMPLES_EXT, &maxSamples); - // isMultisampleCoverageSupported - if (isGLExtensionSupported(contextID, - "GL_NV_framebuffer_multisample_coverage")) + if (ext->isRenderbufferMultisampleCoverageSupported()) { glGetIntegerv(GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV, &coverageSampleConfigs); diff --git a/src/osg/GLExtensions.cpp b/src/osg/GLExtensions.cpp index 6f10d71d7..630e832ac 100644 --- a/src/osg/GLExtensions.cpp +++ b/src/osg/GLExtensions.cpp @@ -1094,7 +1094,10 @@ GLExtensions::GLExtensions(unsigned int in_contextID): setGLExtensionFuncPtr(glGenRenderbuffers, "glGenRenderbuffers", "glGenRenderbuffersEXT", "glGenRenderbuffersOES", validContext); setGLExtensionFuncPtr(glRenderbufferStorage, "glRenderbufferStorage", "glRenderbufferStorageEXT", "glRenderbufferStorageOES", validContext); setGLExtensionFuncPtr(glRenderbufferStorageMultisample, "glRenderbufferStorageMultisample", "glRenderbufferStorageMultisampleEXT", "glRenderbufferStorageMultisampleOES", validContext); - setGLExtensionFuncPtr(glRenderbufferStorageMultisampleCoverageNV, "glRenderbufferStorageMultisampleCoverageNV", validContext); + if (isGLExtensionSupported(contextID, "GL_NV_framebuffer_multisample_coverage")) + setGLExtensionFuncPtr(glRenderbufferStorageMultisampleCoverageNV, "glRenderbufferStorageMultisampleCoverageNV", validContext); + else + glRenderbufferStorageMultisampleCoverageNV = NULL; setGLExtensionFuncPtr(glBindFramebuffer, "glBindFramebuffer", "glBindFramebufferEXT", "glBindFramebufferOES", validContext); setGLExtensionFuncPtr(glDeleteFramebuffers, "glDeleteFramebuffers", "glDeleteFramebuffersEXT", "glDeleteFramebuffersOES", validContext); setGLExtensionFuncPtr(glGenFramebuffers, "glGenFramebuffers", "glGenFramebuffersEXT", "glGenFramebuffersOES", validContext);