Added extension support checks

This commit is contained in:
Robert Osfield 2018-01-08 10:14:13 +00:00
parent 818dee31d8
commit f866836d60

View File

@ -144,10 +144,12 @@ void Sampler::setBorderColor(const Vec4d& color) { _borderColor = color; _PCdirt
void Sampler::compileGLObjects(State& state) const void Sampler::compileGLObjects(State& state) const
{ {
const GLExtensions* extensions = state.get<GLExtensions>();
if (extensions->glGenSamplers==0) return;
unsigned int contextID = state.getContextID(); unsigned int contextID = state.getContextID();
if(_PCdirtyflags[contextID]) if(_PCdirtyflags[contextID])
{ {
const GLExtensions* extensions = state.get<GLExtensions>();
GLuint samplerobject = _PCsampler[contextID]; GLuint samplerobject = _PCsampler[contextID];
if(samplerobject==0) if(samplerobject==0)
{ {
@ -237,6 +239,8 @@ void Sampler::compileGLObjects(State& state) const
/** bind SamplerObject **/ /** bind SamplerObject **/
void Sampler::apply(State&state) const void Sampler::apply(State&state) const
{ {
if (state.get<GLExtensions>()->glGenSamplers==0) return;
unsigned int contextID = state.getContextID(); unsigned int contextID = state.getContextID();
if( _PCdirtyflags[contextID] ) if( _PCdirtyflags[contextID] )
compileGLObjects(state); compileGLObjects(state);
@ -248,6 +252,8 @@ void Sampler::releaseGLObjects(State* state) const
{ {
if(state) if(state)
{ {
if (state->get<GLExtensions>()->glDeleteSamplers==0) return;
unsigned int contextID=state->getContextID(); unsigned int contextID=state->getContextID();
state->get<GLExtensions>()->glDeleteSamplers(1,&_PCsampler[contextID]); state->get<GLExtensions>()->glDeleteSamplers(1,&_PCsampler[contextID]);
} }