[394/906] gstgldisplay: use of GL_DEPTH_COMPONENT16 if OpenGL ES 2.0

glRenderbufferStorage does not accept GL_DEPTH_COMPONENT in
OpenGL ES 2.0.

Fix bug #593786
This commit is contained in:
Pratheesh Gangadhar 2009-10-27 17:02:23 +01:00 committed by Tim-Philipp Müller
parent 8fdf415fb7
commit f93bb87e77

View file

@ -1180,8 +1180,13 @@ gst_gl_display_thread_init_download (GstGLDisplay * display)
glGenRenderbuffersEXT (1, &display->download_depth_buffer);
glBindRenderbufferEXT (GL_RENDERBUFFER_EXT,
display->download_depth_buffer);
#ifndef OPENGL_ES2
glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT,
display->download_width, display->download_height);
#else
glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16,
display->download_width, display->download_height);
#endif
//setup a first texture to render to
glGenTextures (1, &display->download_texture);
@ -1544,8 +1549,13 @@ gst_gl_display_thread_gen_fbo (GstGLDisplay * display)
//setup the render buffer for depth
glGenRenderbuffersEXT (1, &display->generated_depth_buffer);
glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, display->generated_depth_buffer);
#ifndef OPENGL_ES2
glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT,
display->gen_fbo_width, display->gen_fbo_height);
#else
glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16,
display->gen_fbo_width, display->gen_fbo_height);
#endif
//setup a texture to render to
glGenTextures (1, &fake_texture);
@ -2109,7 +2119,8 @@ gst_gl_display_new (void)
/* Create an opengl context (one context for one GstGLDisplay) */
void
gst_gl_display_create_context (GstGLDisplay * display, gulong external_gl_context)
gst_gl_display_create_context (GstGLDisplay * display,
gulong external_gl_context)
{
gst_gl_display_lock (display);
@ -2117,7 +2128,8 @@ gst_gl_display_create_context (GstGLDisplay * display, gulong external_gl_contex
display->external_gl_context = external_gl_context;
display->gl_thread = g_thread_create (
(GThreadFunc) gst_gl_display_thread_create_context, display, TRUE, NULL);
(GThreadFunc) gst_gl_display_thread_create_context, display, TRUE,
NULL);
g_cond_wait (display->cond_create_context, display->mutex);
@ -2513,8 +2525,13 @@ gst_gl_display_thread_init_upload_fbo (GstGLDisplay * display)
//setup the render buffer for depth
glGenRenderbuffersEXT (1, &display->upload_depth_buffer);
glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, display->upload_depth_buffer);
#ifndef OPENGL_ES2
glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT,
display->upload_width, display->upload_height);
#else
glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16,
display->upload_width, display->upload_height);
#endif
//a fake texture is attached to the upload FBO (cannot init without it)
glGenTextures (1, &fake_texture);