From 8c521939b9a93834df3b1536e1850101f31cb89c Mon Sep 17 00:00:00 2001 From: numzero Date: Mon, 27 Feb 2023 17:41:03 +0300 Subject: [PATCH] Enumerate extensions in the OpenGL 3 way --- source/Irrlicht/mt_opengl_loader.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/source/Irrlicht/mt_opengl_loader.cpp b/source/Irrlicht/mt_opengl_loader.cpp index 96d7587..26de3d3 100755 --- a/source/Irrlicht/mt_opengl_loader.cpp +++ b/source/Irrlicht/mt_opengl_loader.cpp @@ -756,11 +756,22 @@ void OpenGLProcedures::LoadAllProcedures(irr::video::IContextManager *cmgr) if (!NamedBufferPageCommitment) NamedBufferPageCommitment = (PFNGLNAMEDBUFFERPAGECOMMITMENTPROC_MT)cmgr->getProcAddress("glNamedBufferPageCommitmentARB"); 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 - std::string ext_string = std::string((char*)GetString(EXTENSIONS)); - std::stringstream ext_ss(ext_string); + std::stringstream ext_ss((char*)ext_str); std::string tmp; while (std::getline(ext_ss, tmp, ' ')) extensions.emplace(tmp); - }