Enumerate extensions in the OpenGL 3 way

This commit is contained in:
numzero 2023-02-27 17:41:03 +03:00
parent cfa8dd7845
commit 8c521939b9

@ -756,11 +756,22 @@ void OpenGLProcedures::LoadAllProcedures(irr::video::IContextManager *cmgr)
if (!NamedBufferPageCommitment) NamedBufferPageCommitment = (PFNGLNAMEDBUFFERPAGECOMMITMENTPROC_MT)cmgr->getProcAddress("glNamedBufferPageCommitmentARB"); if (!NamedBufferPageCommitment) NamedBufferPageCommitment = (PFNGLNAMEDBUFFERPAGECOMMITMENTPROC_MT)cmgr->getProcAddress("glNamedBufferPageCommitmentARB");
if (!TexPageCommitment) TexPageCommitment = (PFNGLTEXPAGECOMMITMENTPROC_MT)cmgr->getProcAddress("glTexPageCommitmentARB"); if (!TexPageCommitment) TexPageCommitment = (PFNGLTEXPAGECOMMITMENTPROC_MT)cmgr->getProcAddress("glTexPageCommitmentARB");
// OpenGL 3 way to enumerate extensions
int ext_count = 0;
GetIntegerv(NUM_EXTENSIONS, &ext_count);
extensions.reserve(ext_count);
for (int k = 0; k < ext_count; k++)
extensions.emplace((char *)GetStringi(EXTENSIONS, k));
if (ext_count)
return;
// OpenGL 2 / ES 2 way to enumerate extensions
auto ext_str = GetString(EXTENSIONS);
if (!ext_str)
return;
// get the extension string, chop it up // get the extension string, chop it up
std::string ext_string = std::string((char*)GetString(EXTENSIONS)); std::stringstream ext_ss((char*)ext_str);
std::stringstream ext_ss(ext_string);
std::string tmp; std::string tmp;
while (std::getline(ext_ss, tmp, ' ')) while (std::getline(ext_ss, tmp, ' '))
extensions.emplace(tmp); extensions.emplace(tmp);
} }