mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-03 01:02:19 +00:00
glx: ask for a GL3 core context
This commit is contained in:
parent
d3fef37d61
commit
86c084f1af
2 changed files with 19 additions and 13 deletions
|
@ -1178,7 +1178,7 @@ _init_convert_fbo (GstGLColorConvert * convert)
|
||||||
/* setup the render buffer for depth */
|
/* setup the render buffer for depth */
|
||||||
gl->GenRenderbuffers (1, &convert->depth_buffer);
|
gl->GenRenderbuffers (1, &convert->depth_buffer);
|
||||||
gl->BindRenderbuffer (GL_RENDERBUFFER, 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,
|
gl->RenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT,
|
||||||
out_width, out_height);
|
out_width, out_height);
|
||||||
gl->RenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH24_STENCIL8,
|
gl->RenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH24_STENCIL8,
|
||||||
|
|
|
@ -145,7 +145,7 @@ gst_gl_context_glx_create_context (GstGLContext * context,
|
||||||
GstGLDisplay *display;
|
GstGLDisplay *display;
|
||||||
gboolean create_context;
|
gboolean create_context;
|
||||||
const char *glx_exts;
|
const char *glx_exts;
|
||||||
int x_error;
|
int x_error = 0;
|
||||||
Display *device;
|
Display *device;
|
||||||
guintptr external_gl_context = 0;
|
guintptr external_gl_context = 0;
|
||||||
|
|
||||||
|
@ -176,8 +176,8 @@ gst_gl_context_glx_create_context (GstGLContext * context,
|
||||||
if (create_context && context_glx->priv->glXCreateContextAttribsARB) {
|
if (create_context && context_glx->priv->glXCreateContextAttribsARB) {
|
||||||
int context_attribs_3[] = {
|
int context_attribs_3[] = {
|
||||||
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
|
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
|
||||||
GLX_CONTEXT_MINOR_VERSION_ARB, 0,
|
GLX_CONTEXT_MINOR_VERSION_ARB, 1,
|
||||||
//GLX_CONTEXT_FLAGS_ARB , GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
|
GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
|
||||||
#if !defined(GST_DISABLE_GST_DEBUG)
|
#if !defined(GST_DISABLE_GST_DEBUG)
|
||||||
GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB,
|
GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB,
|
||||||
#endif
|
#endif
|
||||||
|
@ -190,17 +190,23 @@ gst_gl_context_glx_create_context (GstGLContext * context,
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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 ();
|
gst_gl_window_x11_trap_x_errors ();
|
||||||
context_glx->glx_context =
|
context_glx->glx_context =
|
||||||
context_glx->priv->glXCreateContextAttribsARB (device,
|
context_glx->priv->glXCreateContextAttribsARB (device,
|
||||||
context_glx->priv->fbconfigs[0], (GLXContext) external_gl_context, True,
|
context_glx->priv->fbconfigs[0], (GLXContext) external_gl_context,
|
||||||
context_attribs_3);
|
True, context_attribs_3);
|
||||||
|
|
||||||
x_error = gst_gl_window_x11_untrap_x_errors ();
|
x_error = gst_gl_window_x11_untrap_x_errors ();
|
||||||
context_glx->priv->context_api = GST_GL_API_OPENGL;
|
|
||||||
|
|
||||||
if (!context_glx->glx_context || x_error != 0) {
|
if (x_error != 0)
|
||||||
GST_DEBUG ("Failed to create an Opengl 3 context. trying a legacy one");
|
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 ();
|
gst_gl_window_x11_trap_x_errors ();
|
||||||
context_glx->glx_context =
|
context_glx->glx_context =
|
||||||
|
|
Loading…
Reference in a new issue