Skip to content

Commit 5361251

Browse files
committed
glgsg: more reliable check for core/compat profile
Fixes panda3d#643
1 parent 7f0ac22 commit 5361251

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

panda/src/glstuff/glGraphicsStateGuardian_src.cxx

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,31 @@ reset() {
597597
query_glsl_version();
598598

599599
#ifndef OPENGLES
600-
bool core_profile = is_at_least_gl_version(3, 2) &&
601-
!has_extension("GL_ARB_compatibility");
600+
// Determine whether this OpenGL context has compatibility features.
601+
bool core_profile = false;
602+
603+
if (_gl_version_major >= 3) {
604+
if (_gl_version_major > 3 || _gl_version_minor >= 2) {
605+
// OpenGL 3.2 has a built-in way to check this.
606+
GLint profile_mask = 0;
607+
glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &profile_mask);
608+
609+
if (profile_mask & GL_CONTEXT_CORE_PROFILE_BIT) {
610+
core_profile = true;
611+
} else if (profile_mask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) {
612+
core_profile = false;
613+
} else {
614+
core_profile = !has_extension("GL_ARB_compatibility");
615+
}
616+
} else {
617+
// OpenGL 3.0/3.1.
618+
GLint flags = 0;
619+
glGetIntegerv(GL_CONTEXT_FLAGS, &flags);
620+
if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT) {
621+
core_profile = true;
622+
}
623+
}
624+
}
602625

603626
if (GLCAT.is_debug()) {
604627
if (core_profile) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy