--- /tmp/gstgldisplay.c	2009-09-28 00:49:48.000000000 +0530
+++ git/gst-libs/gst/gl/gstgldisplay.c	2009-09-30 12:32:53.000000000 +0530
@@ -1172,9 +1172,13 @@ gst_gl_display_thread_init_download (Gst
         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);
         glBindTexture (GL_TEXTURE_RECTANGLE_ARB, display->download_texture);
@@ -1536,8 +1540,13 @@ gst_gl_display_thread_gen_fbo (GstGLDisp
   //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);
+      display->download_width, display->download_height);
+#else
+  glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16,
+      display->download_width, display->download_height);
+#endif
 
   //setup a texture to render to
   glGenTextures (1, &fake_texture);
@@ -2422,8 +2431,13 @@ gst_gl_display_thread_init_upload_fbo (G
     //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);
+        display->download_width, display->download_height);
+#else
+    glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16,
+        display->download_width, display->download_height);
+#endif
 
     //a fake texture is attached to the upload FBO (cannot init without it)
     glGenTextures (1, &fake_texture);
