X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fextension.cpp;fp=source%2Fextension.cpp;h=78fc7e1c3c767caf5c7ac10693ca3ebc0e947aab;hp=2183a965027d85550447fc77589f419789db890d;hb=bd994b9a1376a021022e5145f30b7566e7923e4d;hpb=b015ee91380afcde026b101a9598a50e82827938 diff --git a/source/extension.cpp b/source/extension.cpp index 2183a965..78fc7e1c 100644 --- a/source/extension.cpp +++ b/source/extension.cpp @@ -132,6 +132,25 @@ GLApi get_gl_api() #endif } +inline GLProfile _get_gl_profile() +{ + if(get_gl_api()==OPENGL && get_gl_version()>=Version(3, 0)) + { + int mask; + glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask); + if(mask==GL_CONTEXT_CORE_PROFILE_BIT) + return CORE_PROFILE; + } + + return COMPATIBILITY_PROFILE; +} + +GLProfile get_gl_profile() +{ + static GLProfile profile = _get_gl_profile(); + return profile; +} + inline Version _get_gl_version() { const char *gl_ver_ptr = reinterpret_cast(glGetString(GL_VERSION));