// Return true to activate the shader function. bool operator()(const osg::State& state) { osg::Camera* camera = *state.getGraphicsContext()->getCameras().begin(); if (!camera) return false; osg::Viewport* viewport = camera->getViewport(); if (!viewport) return false; return viewport->width() > 1000; }