mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 00:06:44 -04:00
glgsg: add gl-forward-compatible config variable
This is meant to be used alongside gl-version to request a "forward compatible" OpenGL 3.0 or 3.1 context, which removes support for deprecated features such as the fixed-function pipeline.
This commit is contained in:
parent
53612512d5
commit
475bd55bb1
@ -17,6 +17,11 @@ ConfigVariableInt gl_version
|
||||
("gl-version", "",
|
||||
PRC_DESC("Set this to get an OpenGL context with a specific version."));
|
||||
|
||||
ConfigVariableBool gl_forward_compatible
|
||||
("gl-forward-compatible", false,
|
||||
PRC_DESC("Setting this to true will request a forward-compatible OpenGL "
|
||||
"context, which will not support the fixed-function pipeline."));
|
||||
|
||||
ConfigVariableBool gl_support_fbo
|
||||
("gl-support-fbo", true,
|
||||
PRC_DESC("Configure this false if your GL's implementation of "
|
||||
|
@ -41,6 +41,7 @@
|
||||
// #define GSG_VERBOSE 1
|
||||
|
||||
extern EXPCL_GL ConfigVariableInt gl_version;
|
||||
extern EXPCL_GL ConfigVariableBool gl_forward_compatible;
|
||||
extern EXPCL_GL ConfigVariableBool gl_support_fbo;
|
||||
extern ConfigVariableBool gl_cheap_textures;
|
||||
extern ConfigVariableBool gl_ignore_clamp;
|
||||
|
@ -352,9 +352,20 @@ choose_pixel_format(const FrameBufferProperties &properties,
|
||||
attrib_list[n++] = gl_version[1];
|
||||
}
|
||||
}
|
||||
int flags = 0;
|
||||
if (gl_debug) {
|
||||
flags |= GLX_CONTEXT_DEBUG_BIT_ARB;
|
||||
}
|
||||
if (gl_forward_compatible) {
|
||||
flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
|
||||
if (gl_version.get_num_words() == 0 || gl_version[0] < 2) {
|
||||
glxdisplay_cat.error()
|
||||
<< "gl-forward-compatible requires gl-version >= 3 0\n";
|
||||
}
|
||||
}
|
||||
if (flags != 0) {
|
||||
attrib_list[n++] = GLX_CONTEXT_FLAGS_ARB;
|
||||
attrib_list[n++] = GLX_CONTEXT_DEBUG_BIT_ARB;
|
||||
attrib_list[n++] = flags;
|
||||
}
|
||||
attrib_list[n] = None;
|
||||
_context = _glXCreateContextAttribs(_display, _fbconfig, _share_context,
|
||||
|
@ -609,9 +609,20 @@ make_context(HDC hdc) {
|
||||
attrib_list[n++] = gl_version[1];
|
||||
}
|
||||
}
|
||||
int flags = 0;
|
||||
if (gl_debug) {
|
||||
flags |= WGL_CONTEXT_DEBUG_BIT_ARB;
|
||||
}
|
||||
if (gl_forward_compatible) {
|
||||
flags |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
|
||||
if (gl_version.get_num_words() == 0 || gl_version[0] < 2) {
|
||||
wgldisplay_cat.error()
|
||||
<< "gl-forward-compatible requires gl-version >= 3 0\n";
|
||||
}
|
||||
}
|
||||
if (flags != 0) {
|
||||
attrib_list[n++] = WGL_CONTEXT_FLAGS_ARB;
|
||||
attrib_list[n++] = WGL_CONTEXT_DEBUG_BIT_ARB;
|
||||
attrib_list[n++] = flags;
|
||||
}
|
||||
#ifndef SUPPORT_FIXED_FUNCTION
|
||||
attrib_list[n++] = WGL_CONTEXT_PROFILE_MASK_ARB;
|
||||
|
Loading…
x
Reference in New Issue
Block a user