std::set<GLextension> ContextInfo::extensions(std::set<std::string> * const unknown) { const auto v = version(); if (v <= Version(1, 0)) // OpenGL 1.0 doesn't support extensions { return std::set<GLextension>{}; } auto extensions = std::set<GLextension>{}; if (v < Version(3, 0)) { const auto extensionString = glGetString(GL_EXTENSIONS); if (extensionString) { std::istringstream stream{reinterpret_cast<const char *>(extensionString)}; auto extensionName = std::string{}; while (std::getline(stream, extensionName, ' ')) { insertExtension(extensionName, &extensions, unknown); } } } else { auto numExtensions = 0; glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions); for (GLuint i = 0; i < static_cast<GLuint>(numExtensions); ++i) { const auto name = glGetStringi(GL_EXTENSIONS, i); if (name) { insertExtension(reinterpret_cast<const char*>(name), &extensions, unknown); } } } return extensions; }
bool QXmppClient::addExtension(QXmppClientExtension* extension) { return insertExtension(d->extensions.size(), extension); }