glframebuffer: add support for gl3

This commit is contained in:
Matthew Waters 2014-11-12 22:48:04 +11:00
parent a32f29f2ce
commit 5ff5f8c1ee

View file

@ -112,11 +112,12 @@ gst_gl_framebuffer_generate (GstGLFramebuffer * frame, gint width, gint height,
gl->GenRenderbuffers (1, depth); gl->GenRenderbuffers (1, depth);
gl->BindRenderbuffer (GL_RENDERBUFFER, *depth); gl->BindRenderbuffer (GL_RENDERBUFFER, *depth);
if (gst_gl_context_get_gl_api (frame->context) & GST_GL_API_OPENGL) { if (gst_gl_context_get_gl_api (frame->context) & (GST_GL_API_OPENGL |
gl->RenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT, GST_GL_API_OPENGL3)) {
width, height); gl->RenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width,
gl->RenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, height);
width, height); gl->RenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, width,
height);
} }
if (gst_gl_context_get_gl_api (frame->context) & GST_GL_API_GLES2) { if (gst_gl_context_get_gl_api (frame->context) & GST_GL_API_GLES2) {
gl->RenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, gl->RenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT16,
@ -141,7 +142,8 @@ gst_gl_framebuffer_generate (GstGLFramebuffer * frame, gint width, gint height,
gl->FramebufferRenderbuffer (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, gl->FramebufferRenderbuffer (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
GL_RENDERBUFFER, *depth); GL_RENDERBUFFER, *depth);
if (gst_gl_context_get_gl_api (frame->context) & GST_GL_API_OPENGL) { if (gst_gl_context_get_gl_api (frame->context) & (GST_GL_API_OPENGL |
GST_GL_API_OPENGL3)) {
gl->FramebufferRenderbuffer (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, gl->FramebufferRenderbuffer (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
GL_RENDERBUFFER, *depth); GL_RENDERBUFFER, *depth);
} }
@ -299,7 +301,8 @@ gst_gl_framebuffer_use_v2 (GstGLFramebuffer * frame, gint texture_fbo_width,
gl->Viewport (0, 0, texture_fbo_width, texture_fbo_height); gl->Viewport (0, 0, texture_fbo_width, texture_fbo_height);
if (gst_gl_context_get_gl_api (frame->context) & GST_GL_API_OPENGL) if (gst_gl_context_get_gl_api (frame->context) & (GST_GL_API_OPENGL |
GST_GL_API_OPENGL3))
gl->DrawBuffer (GL_COLOR_ATTACHMENT0); gl->DrawBuffer (GL_COLOR_ATTACHMENT0);
gl->ClearColor (0.0, 0.0, 0.0, 0.0); gl->ClearColor (0.0, 0.0, 0.0, 0.0);
@ -308,7 +311,8 @@ gst_gl_framebuffer_use_v2 (GstGLFramebuffer * frame, gint texture_fbo_width,
/* the opengl scene */ /* the opengl scene */
cb (stuff); cb (stuff);
if (gst_gl_context_get_gl_api (frame->context) & GST_GL_API_OPENGL) if (gst_gl_context_get_gl_api (frame->context) & (GST_GL_API_OPENGL |
GST_GL_API_OPENGL3))
gl->DrawBuffer (GL_NONE); gl->DrawBuffer (GL_NONE);
gl->Viewport (viewport_dim[0], viewport_dim[1], gl->Viewport (viewport_dim[0], viewport_dim[1],