From f866836d606a29dee727b34d17d7f7f504a39fe8 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 8 Jan 2018 10:14:13 +0000 Subject: [PATCH] Added extension support checks --- src/osg/Sampler.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/osg/Sampler.cpp b/src/osg/Sampler.cpp index c2f89443b..69d3b21c5 100644 --- a/src/osg/Sampler.cpp +++ b/src/osg/Sampler.cpp @@ -144,10 +144,12 @@ void Sampler::setBorderColor(const Vec4d& color) { _borderColor = color; _PCdirt void Sampler::compileGLObjects(State& state) const { + const GLExtensions* extensions = state.get(); + if (extensions->glGenSamplers==0) return; + unsigned int contextID = state.getContextID(); if(_PCdirtyflags[contextID]) { - const GLExtensions* extensions = state.get(); GLuint samplerobject = _PCsampler[contextID]; if(samplerobject==0) { @@ -237,6 +239,8 @@ void Sampler::compileGLObjects(State& state) const /** bind SamplerObject **/ void Sampler::apply(State&state) const { + if (state.get()->glGenSamplers==0) return; + unsigned int contextID = state.getContextID(); if( _PCdirtyflags[contextID] ) compileGLObjects(state); @@ -248,6 +252,8 @@ void Sampler::releaseGLObjects(State* state) const { if(state) { + if (state->get()->glDeleteSamplers==0) return; + unsigned int contextID=state->getContextID(); state->get()->glDeleteSamplers(1,&_PCsampler[contextID]); }