glx: ask for a GL3 core context

This commit is contained in:
Matthew Waters 2014-10-19 08:09:37 +04:00
parent 1200f2f94b
commit 2c24b97cf0
2 changed files with 19 additions and 13 deletions

View file

@ -1178,7 +1178,7 @@ _init_convert_fbo (GstGLColorConvert * convert)
/* setup the render buffer for depth */
gl->GenRenderbuffers (1, &convert->depth_buffer);
gl->BindRenderbuffer (GL_RENDERBUFFER, convert->depth_buffer);
if (USING_OPENGL (convert->context)) {
if (USING_OPENGL (convert->context) || USING_OPENGL3 (convert->context)) {
gl->RenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT,
out_width, out_height);
gl->RenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH24_STENCIL8,

View file

@ -145,7 +145,7 @@ gst_gl_context_glx_create_context (GstGLContext * context,
GstGLDisplay *display;
gboolean create_context;
const char *glx_exts;
int x_error;
int x_error = 0;
Display *device;
guintptr external_gl_context = 0;
@ -176,8 +176,8 @@ gst_gl_context_glx_create_context (GstGLContext * context,
if (create_context && context_glx->priv->glXCreateContextAttribsARB) {
int context_attribs_3[] = {
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
GLX_CONTEXT_MINOR_VERSION_ARB, 0,
//GLX_CONTEXT_FLAGS_ARB , GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
GLX_CONTEXT_MINOR_VERSION_ARB, 1,
GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
#if !defined(GST_DISABLE_GST_DEBUG)
GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB,
#endif
@ -190,17 +190,23 @@ gst_gl_context_glx_create_context (GstGLContext * context,
None
};
gst_gl_window_x11_trap_x_errors ();
context_glx->glx_context =
context_glx->priv->glXCreateContextAttribsARB (device,
context_glx->priv->fbconfigs[0], (GLXContext) external_gl_context, True,
context_attribs_3);
if (gl_api & GST_GL_API_OPENGL3) {
GST_DEBUG_OBJECT (window, "trying to create a GL 3.1 core context");
gst_gl_window_x11_trap_x_errors ();
context_glx->glx_context =
context_glx->priv->glXCreateContextAttribsARB (device,
context_glx->priv->fbconfigs[0], (GLXContext) external_gl_context,
True, context_attribs_3);
x_error = gst_gl_window_x11_untrap_x_errors ();
context_glx->priv->context_api = GST_GL_API_OPENGL;
x_error = gst_gl_window_x11_untrap_x_errors ();
if (!context_glx->glx_context || x_error != 0) {
GST_DEBUG ("Failed to create an Opengl 3 context. trying a legacy one");
if (x_error != 0)
context_glx->glx_context = NULL;
context_glx->priv->context_api = GST_GL_API_OPENGL3;
}
if (gl_api & GST_GL_API_OPENGL && context_glx->glx_context == NULL) {
GST_DEBUG_OBJECT (window, "trying to create a GL 1.4 context");
gst_gl_window_x11_trap_x_errors ();
context_glx->glx_context =