[327/906] fix init FBO's texture attachment on ES 2.0

This commit is contained in:
Julien 2009-04-10 20:42:59 +02:00 committed by Matthew Waters
parent bb0781a389
commit bf0b1fa1ab

View file

@ -236,11 +236,9 @@ gst_gl_display_init (GstGLDisplay * display, GstGLDisplayClass * klass)
"uniform sampler2DRect Ytex, UVtex;\n" "uniform sampler2DRect Ytex, UVtex;\n"
#else #else
"precision mediump float;\n" "precision mediump float;\n"
"varying vec2 v_texCoord;\n" "varying vec2 v_texCoord;\n" "uniform sampler2D Ytex, UVtex;\n"
"uniform sampler2D Ytex, UVtex;\n"
#endif #endif
"void main(void) {\n" "void main(void) {\n" " float fx, fy, y, u, v, r, g, b;\n"
" float fx, fy, y, u, v, r, g, b;\n"
#ifndef OPENGL_ES2 #ifndef OPENGL_ES2
" fx = gl_TexCoord[0].x;\n" " fx = gl_TexCoord[0].x;\n"
" fy = gl_TexCoord[0].y;\n" " fy = gl_TexCoord[0].y;\n"
@ -259,9 +257,7 @@ gst_gl_display_init (GstGLDisplay * display, GstGLDisplayClass * klass)
" v=v-0.5;\n" " v=v-0.5;\n"
" r = y+1.5958*v;\n" " r = y+1.5958*v;\n"
" g = y-0.39173*u-0.81290*v;\n" " g = y-0.39173*u-0.81290*v;\n"
" b = y+2.017*u;\n" " b = y+2.017*u;\n" " gl_FragColor = vec4(r, g, b, 1.0);\n" "}\n";
" gl_FragColor = vec4(r, g, b, 1.0);\n"
"}\n";
//ATI: "*0.5", "" //ATI: "*0.5", ""
//normal: "", "*0.5" //normal: "", "*0.5"
@ -271,11 +267,9 @@ gst_gl_display_init (GstGLDisplay * display, GstGLDisplayClass * klass)
"uniform sampler2DRect Ytex,Utex,Vtex;\n" "uniform sampler2DRect Ytex,Utex,Vtex;\n"
#else #else
"precision mediump float;\n" "precision mediump float;\n"
"varying vec2 v_texCoord;\n" "varying vec2 v_texCoord;\n" "uniform sampler2D Ytex,Utex,Vtex;\n"
"uniform sampler2D Ytex,Utex,Vtex;\n"
#endif #endif
"void main(void) {\n" "void main(void) {\n" " float r,g,b,y,u,v;\n"
" float r,g,b,y,u,v;\n"
#ifndef OPENGL_ES2 #ifndef OPENGL_ES2
" vec2 nxy = gl_TexCoord[0].xy;\n" " vec2 nxy = gl_TexCoord[0].xy;\n"
" y=texture2DRect(Ytex,nxy%s).r;\n" " y=texture2DRect(Ytex,nxy%s).r;\n"
@ -284,17 +278,14 @@ gst_gl_display_init (GstGLDisplay * display, GstGLDisplayClass * klass)
#else #else
" vec2 nxy = v_texCoord.xy;\n" " vec2 nxy = v_texCoord.xy;\n"
" y=texture2D(Ytex,nxy).r;\n" " y=texture2D(Ytex,nxy).r;\n"
" u=texture2D(Utex,nxy).r;\n" " u=texture2D(Utex,nxy).r;\n" " v=texture2D(Vtex,nxy).r;\n"
" v=texture2D(Vtex,nxy).r;\n"
#endif #endif
" y=1.1643*(y-0.0625);\n" " y=1.1643*(y-0.0625);\n"
" u=u-0.5;\n" " u=u-0.5;\n"
" v=v-0.5;\n" " v=v-0.5;\n"
" r=y+1.5958*v;\n" " r=y+1.5958*v;\n"
" g=y-0.39173*u-0.81290*v;\n" " g=y-0.39173*u-0.81290*v;\n"
" b=y+2.017*u;\n" " b=y+2.017*u;\n" " gl_FragColor=vec4(r,g,b,1.0);\n" "}\n";
" gl_FragColor=vec4(r,g,b,1.0);\n"
"}\n";
display->text_shader_upload_AYUV = display->text_shader_upload_AYUV =
#ifndef OPENGL_ES2 #ifndef OPENGL_ES2
@ -302,30 +293,24 @@ gst_gl_display_init (GstGLDisplay * display, GstGLDisplayClass * klass)
"uniform sampler2DRect tex;\n" "uniform sampler2DRect tex;\n"
#else #else
"precision mediump float;\n" "precision mediump float;\n"
"varying vec2 v_texCoord;\n" "varying vec2 v_texCoord;\n" "uniform sampler2D tex;\n"
"uniform sampler2D tex;\n"
#endif #endif
"void main(void) {\n" "void main(void) {\n" " float r,g,b,y,u,v;\n"
" float r,g,b,y,u,v;\n"
#ifndef OPENGL_ES2 #ifndef OPENGL_ES2
" vec2 nxy=gl_TexCoord[0].xy;\n" " vec2 nxy=gl_TexCoord[0].xy;\n"
" y=texture2DRect(tex,nxy).r;\n" " y=texture2DRect(tex,nxy).r;\n"
" u=texture2DRect(tex,nxy).g;\n" " u=texture2DRect(tex,nxy).g;\n" " v=texture2DRect(tex,nxy).b;\n"
" v=texture2DRect(tex,nxy).b;\n"
#else #else
" vec2 nxy = v_texCoord.xy;\n" " vec2 nxy = v_texCoord.xy;\n"
" y=texture2D(tex,nxy).g;\n" " y=texture2D(tex,nxy).g;\n"
" u=texture2D(tex,nxy).b;\n" " u=texture2D(tex,nxy).b;\n" " v=texture2D(tex,nxy).a;\n"
" v=texture2D(tex,nxy).a;\n"
#endif #endif
" y=1.1643*(y-0.0625);\n" " y=1.1643*(y-0.0625);\n"
" u=u-0.5;\n" " u=u-0.5;\n"
" v=v-0.5;\n" " v=v-0.5;\n"
" r=y+1.5958*v;\n" " r=y+1.5958*v;\n"
" g=y-0.39173*u-0.81290*v;\n" " g=y-0.39173*u-0.81290*v;\n"
" b=y+2.017*u;\n" " b=y+2.017*u;\n" " gl_FragColor=vec4(r,g,b,1.0);\n" "}\n";
" gl_FragColor=vec4(r,g,b,1.0);\n"
"}\n";
//YUY2:y2,u,y1,v //YUY2:y2,u,y1,v
//UYVY:v,y1,u,y2 //UYVY:v,y1,u,y2
@ -335,11 +320,9 @@ gst_gl_display_init (GstGLDisplay * display, GstGLDisplayClass * klass)
"uniform sampler2DRect tex;\n" "uniform sampler2DRect tex;\n"
#else #else
"precision mediump float;\n" "precision mediump float;\n"
"varying vec2 v_texCoord;\n" "varying vec2 v_texCoord;\n" "uniform sampler2D tex;\n"
"uniform sampler2D tex;\n"
#endif #endif
"void main(void) {\n" "void main(void) {\n" " float fx,fy,r,g,b,r2,g2,b2,y1,y2,u,v;\n"
" float fx,fy,r,g,b,r2,g2,b2,y1,y2,u,v;\n"
#ifndef OPENGL_ES2 #ifndef OPENGL_ES2
" fx = gl_TexCoord[0].x;\n" " fx = gl_TexCoord[0].x;\n"
" fy = gl_TexCoord[0].y;\n" " fy = gl_TexCoord[0].y;\n"
@ -365,10 +348,7 @@ gst_gl_display_init (GstGLDisplay * display, GstGLDisplayClass * klass)
" v=0.439271*r - 0.367833*g - 0.071438*b ;\n" " v=0.439271*r - 0.367833*g - 0.071438*b ;\n"
" y1=0.858885*y1 + 0.0625;\n" " y1=0.858885*y1 + 0.0625;\n"
" y2=0.858885*y2 + 0.0625;\n" " y2=0.858885*y2 + 0.0625;\n"
" u=u + 0.5;\n" " u=u + 0.5;\n" " v=v + 0.5;\n" " gl_FragColor=vec4(%s);\n" "}\n";
" v=v + 0.5;\n"
" gl_FragColor=vec4(%s);\n"
"}\n";
//no OpenGL ES 2.0 support because for now it's not possible //no OpenGL ES 2.0 support because for now it's not possible
//to attach multiple textures to a frame buffer object //to attach multiple textures to a frame buffer object
@ -394,8 +374,7 @@ gst_gl_display_init (GstGLDisplay * display, GstGLDisplayClass * klass)
" v=v + 0.5;\n" " v=v + 0.5;\n"
" gl_FragData[0] = vec4(y, 0.0, 0.0, 1.0);\n" " gl_FragData[0] = vec4(y, 0.0, 0.0, 1.0);\n"
" gl_FragData[1] = vec4(u, 0.0, 0.0, 1.0);\n" " gl_FragData[1] = vec4(u, 0.0, 0.0, 1.0);\n"
" gl_FragData[2] = vec4(v, 0.0, 0.0, 1.0);\n" " gl_FragData[2] = vec4(v, 0.0, 0.0, 1.0);\n" "}\n";
"}\n";
display->text_shader_download_AYUV = display->text_shader_download_AYUV =
#ifndef OPENGL_ES2 #ifndef OPENGL_ES2
@ -403,28 +382,22 @@ gst_gl_display_init (GstGLDisplay * display, GstGLDisplayClass * klass)
"uniform sampler2DRect tex;\n" "uniform sampler2DRect tex;\n"
#else #else
"precision mediump float;\n" "precision mediump float;\n"
"varying vec2 v_texCoord;\n" "varying vec2 v_texCoord;\n" "uniform sampler2D tex;\n"
"uniform sampler2D tex;\n"
#endif #endif
"void main(void) {\n" "void main(void) {\n" " float r,g,b,y,u,v;\n"
" float r,g,b,y,u,v;\n"
#ifndef OPENGL_ES2 #ifndef OPENGL_ES2
" vec2 nxy=gl_TexCoord[0].xy;\n" " vec2 nxy=gl_TexCoord[0].xy;\n"
" r=texture2DRect(tex,nxy).r;\n" " r=texture2DRect(tex,nxy).r;\n"
" g=texture2DRect(tex,nxy).g;\n" " g=texture2DRect(tex,nxy).g;\n" " b=texture2DRect(tex,nxy).b;\n"
" b=texture2DRect(tex,nxy).b;\n"
#else #else
" vec2 nxy=v_texCoord.xy;\n" " vec2 nxy=v_texCoord.xy;\n"
" r=texture2D(tex,nxy).r;\n" " r=texture2D(tex,nxy).r;\n"
" g=texture2D(tex,nxy).g;\n" " g=texture2D(tex,nxy).g;\n" " b=texture2D(tex,nxy).b;\n"
" b=texture2D(tex,nxy).b;\n"
#endif #endif
" y=0.299011*r + 0.586987*g + 0.114001*b;\n" " y=0.299011*r + 0.586987*g + 0.114001*b;\n"
" u=-0.148246*r -0.29102*g + 0.439266*b;\n" " u=-0.148246*r -0.29102*g + 0.439266*b;\n"
" v=0.439271*r - 0.367833*g - 0.071438*b ;\n" " v=0.439271*r - 0.367833*g - 0.071438*b ;\n"
" y=0.858885*y + 0.0625;\n" " y=0.858885*y + 0.0625;\n" " u=u + 0.5;\n" " v=v + 0.5;\n"
" u=u + 0.5;\n"
" v=v + 0.5;\n"
#ifndef OPENGL_ES2 #ifndef OPENGL_ES2
" gl_FragColor=vec4(y,u,v,1.0);\n" " gl_FragColor=vec4(y,u,v,1.0);\n"
#else #else
@ -440,8 +413,7 @@ gst_gl_display_init (GstGLDisplay * display, GstGLDisplayClass * klass)
"void main() \n" "void main() \n"
"{ \n" "{ \n"
" gl_Position = a_position; \n" " gl_Position = a_position; \n"
" v_texCoord = a_texCoord; \n" " v_texCoord = a_texCoord; \n" "} \n";
"} \n";
display->redisplay_fragment_shader_str = display->redisplay_fragment_shader_str =
"precision mediump float; \n" "precision mediump float; \n"
@ -459,8 +431,7 @@ gst_gl_display_init (GstGLDisplay * display, GstGLDisplayClass * klass)
"void main() \n" "void main() \n"
"{ \n" "{ \n"
" gl_Position = a_position; \n" " gl_Position = a_position; \n"
" v_texCoord = a_texCoord; \n" " v_texCoord = a_texCoord; \n" "} \n";
"} \n";
display->text_vertex_shader_download = display->text_vertex_shader_download =
"attribute vec4 a_position; \n" "attribute vec4 a_position; \n"
@ -469,8 +440,7 @@ gst_gl_display_init (GstGLDisplay * display, GstGLDisplayClass * klass)
"void main() \n" "void main() \n"
"{ \n" "{ \n"
" gl_Position = a_position; \n" " gl_Position = a_position; \n"
" v_texCoord = a_texCoord; \n" " v_texCoord = a_texCoord; \n" "} \n";
"} \n";
display->text_fragment_shader_download_RGB = display->text_fragment_shader_download_RGB =
"precision mediump float; \n" "precision mediump float; \n"
@ -742,7 +712,6 @@ gst_gl_display_thread_destroy_context (GstGLDisplay * display)
glDeleteTextures (1, &display->upload_intex_v); glDeleteTextures (1, &display->upload_intex_v);
display->upload_intex_v = 0; display->upload_intex_v = 0;
} }
#ifdef OPENGL_ES2 #ifdef OPENGL_ES2
if (display->redisplay_shader) { if (display->redisplay_shader) {
g_object_unref (G_OBJECT (display->redisplay_shader)); g_object_unref (G_OBJECT (display->redisplay_shader));
@ -894,11 +863,11 @@ gst_gl_display_thread_init_upload (GstGLDisplay * display)
display->shader_upload_YUY2 = NULL; display->shader_upload_YUY2 = NULL;
} else { } else {
display->shader_upload_attr_position_loc = display->shader_upload_attr_position_loc =
gst_gl_shader_get_attribute_location (display->shader_upload_YUY2, gst_gl_shader_get_attribute_location
"a_position"); (display->shader_upload_YUY2, "a_position");
display->shader_upload_attr_texture_loc = display->shader_upload_attr_texture_loc =
gst_gl_shader_get_attribute_location (display->shader_upload_YUY2, gst_gl_shader_get_attribute_location
"a_texCoord"); (display->shader_upload_YUY2, "a_texCoord");
} }
#endif #endif
} }
@ -939,11 +908,11 @@ gst_gl_display_thread_init_upload (GstGLDisplay * display)
display->shader_upload_UYVY = NULL; display->shader_upload_UYVY = NULL;
} else { } else {
display->shader_upload_attr_position_loc = display->shader_upload_attr_position_loc =
gst_gl_shader_get_attribute_location (display->shader_upload_UYVY, gst_gl_shader_get_attribute_location
"a_position"); (display->shader_upload_UYVY, "a_position");
display->shader_upload_attr_texture_loc = display->shader_upload_attr_texture_loc =
gst_gl_shader_get_attribute_location (display->shader_upload_UYVY, gst_gl_shader_get_attribute_location
"a_texCoord"); (display->shader_upload_UYVY, "a_texCoord");
} }
#endif #endif
} }
@ -989,11 +958,11 @@ gst_gl_display_thread_init_upload (GstGLDisplay * display)
display->shader_upload_I420_YV12 = NULL; display->shader_upload_I420_YV12 = NULL;
} else { } else {
display->shader_upload_attr_position_loc = display->shader_upload_attr_position_loc =
gst_gl_shader_get_attribute_location (display->shader_upload_I420_YV12, gst_gl_shader_get_attribute_location
"a_position"); (display->shader_upload_I420_YV12, "a_position");
display->shader_upload_attr_texture_loc = display->shader_upload_attr_texture_loc =
gst_gl_shader_get_attribute_location (display->shader_upload_I420_YV12, gst_gl_shader_get_attribute_location
"a_texCoord"); (display->shader_upload_I420_YV12, "a_texCoord");
} }
#endif #endif
} }
@ -1027,11 +996,11 @@ gst_gl_display_thread_init_upload (GstGLDisplay * display)
display->shader_upload_AYUV = NULL; display->shader_upload_AYUV = NULL;
} else { } else {
display->shader_upload_attr_position_loc = display->shader_upload_attr_position_loc =
gst_gl_shader_get_attribute_location (display->shader_upload_AYUV, gst_gl_shader_get_attribute_location
"a_position"); (display->shader_upload_AYUV, "a_position");
display->shader_upload_attr_texture_loc = display->shader_upload_attr_texture_loc =
gst_gl_shader_get_attribute_location (display->shader_upload_AYUV, gst_gl_shader_get_attribute_location
"a_texCoord"); (display->shader_upload_AYUV, "a_texCoord");
} }
#endif #endif
} }
@ -1392,11 +1361,11 @@ gst_gl_display_thread_init_download (GstGLDisplay * display)
display->shader_download_YUY2 = NULL; display->shader_download_YUY2 = NULL;
} else { } else {
display->shader_download_attr_position_loc = display->shader_download_attr_position_loc =
gst_gl_shader_get_attribute_location (display->shader_download_YUY2, gst_gl_shader_get_attribute_location
"a_position"); (display->shader_download_YUY2, "a_position");
display->shader_download_attr_texture_loc = display->shader_download_attr_texture_loc =
gst_gl_shader_get_attribute_location (display->shader_download_YUY2, gst_gl_shader_get_attribute_location
"a_texCoord"); (display->shader_download_YUY2, "a_texCoord");
} }
#endif #endif
} }
@ -1433,11 +1402,11 @@ gst_gl_display_thread_init_download (GstGLDisplay * display)
display->shader_download_UYVY = NULL; display->shader_download_UYVY = NULL;
} else { } else {
display->shader_download_attr_position_loc = display->shader_download_attr_position_loc =
gst_gl_shader_get_attribute_location (display->shader_download_UYVY, gst_gl_shader_get_attribute_location
"a_position"); (display->shader_download_UYVY, "a_position");
display->shader_download_attr_texture_loc = display->shader_download_attr_texture_loc =
gst_gl_shader_get_attribute_location (display->shader_download_UYVY, gst_gl_shader_get_attribute_location
"a_texCoord"); (display->shader_download_UYVY, "a_texCoord");
} }
#endif #endif
@ -1483,11 +1452,11 @@ gst_gl_display_thread_init_download (GstGLDisplay * display)
display->shader_download_AYUV = NULL; display->shader_download_AYUV = NULL;
} else { } else {
display->shader_download_attr_position_loc = display->shader_download_attr_position_loc =
gst_gl_shader_get_attribute_location (display->shader_download_AYUV, gst_gl_shader_get_attribute_location
"a_position"); (display->shader_download_AYUV, "a_position");
display->shader_download_attr_texture_loc = display->shader_download_attr_texture_loc =
gst_gl_shader_get_attribute_location (display->shader_download_AYUV, gst_gl_shader_get_attribute_location
"a_texCoord"); (display->shader_download_AYUV, "a_texCoord");
} }
#endif #endif
break; break;
@ -1570,6 +1539,12 @@ gst_gl_display_thread_gen_fbo (GstGLDisplay * display)
glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA8, glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA8,
display->gen_fbo_width, display->gen_fbo_height, 0, GL_RGBA, display->gen_fbo_width, display->gen_fbo_height, 0, GL_RGBA,
GL_UNSIGNED_BYTE, NULL); GL_UNSIGNED_BYTE, NULL);
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S,
GL_CLAMP_TO_EDGE);
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T,
GL_CLAMP_TO_EDGE);
//attach the texture to the FBO to renderer to //attach the texture to the FBO to renderer to
glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
@ -1658,7 +1633,8 @@ gst_gl_display_thread_use_fbo (GstGLDisplay * display)
glPopMatrix (); glPopMatrix ();
glPopAttrib (); glPopAttrib ();
#else #else
glViewport(viewport_dim[0], viewport_dim[1], viewport_dim[2], viewport_dim[3]); glViewport (viewport_dim[0], viewport_dim[1], viewport_dim[2],
viewport_dim[3]);
#endif #endif
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0); glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
@ -1831,15 +1807,15 @@ gst_gl_display_on_draw (GstGLDisplay * display)
#else //OPENGL_ES2 #else //OPENGL_ES2
const GLfloat vVertices [] = const GLfloat vVertices[] = { 1.0f, 1.0f, 0.0f,
{1.0f, 1.0f, 0.0f,
1.0f, 0.0f, 1.0f, 0.0f,
-1.0f, 1.0f, 0.0f, -1.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f,
-1.0f, -1.0f, 0.0f, -1.0f, -1.0f, 0.0f,
0.0f, 1.0f, 0.0f, 1.0f,
1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 0.0f,
1.0f, 1.0f}; 1.0f, 1.0f
};
GLushort indices[] = { 0, 1, 2, 0, 2, 3 }; GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
@ -2046,7 +2022,19 @@ gst_gl_display_check_framebuffer_status (void)
break; break;
case GL_FRAMEBUFFER_UNSUPPORTED_EXT: case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
GST_ERROR ("GL_FRAMEBUFFER_UNSUPPORTED_EXT"); GST_ERROR ("GL_FRAMEBUFFER_UNSUPPORTED");
break;
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
GST_ERROR ("GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT");
break;
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
GST_ERROR ("GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");
break;
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
GST_ERROR ("GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS");
break; break;
default: default:
@ -2420,6 +2408,14 @@ gst_gl_display_thread_init_upload_fbo (GstGLDisplay * display)
glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA8, glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA8,
display->upload_width, display->upload_height, 0, GL_RGBA, display->upload_width, display->upload_height, 0, GL_RGBA,
GL_UNSIGNED_BYTE, NULL); GL_UNSIGNED_BYTE, NULL);
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER,
GL_LINEAR);
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER,
GL_LINEAR);
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S,
GL_CLAMP_TO_EDGE);
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T,
GL_CLAMP_TO_EDGE);
//attach the texture to the FBO to renderer to //attach the texture to the FBO to renderer to
glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
@ -2699,15 +2695,15 @@ gst_gl_display_thread_do_upload_draw (GstGLDisplay * display)
#ifdef OPENGL_ES2 #ifdef OPENGL_ES2
GLint viewport_dim[4]; GLint viewport_dim[4];
const GLfloat vVertices [] = const GLfloat vVertices[] = { 1.0f, -1.0f, 0.0f,
{1.0f, -1.0f, 0.0f,
1.0f, 0.0f, 1.0f, 0.0f,
-1.0f, -1.0f, 0.0f, -1.0f, -1.0f, 0.0f,
0.0f, .0f, 0.0f, .0f,
-1.0f, 1.0f, 0.0f, -1.0f, 1.0f, 0.0f,
0.0f, 1.0f, 0.0f, 1.0f,
1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f,
1.0f, 1.0f}; 1.0f, 1.0f
};
GLushort indices[] = { 0, 1, 2, 0, 2, 3 }; GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
#endif #endif
@ -2999,7 +2995,8 @@ gst_gl_display_thread_do_upload_draw (GstGLDisplay * display)
glPopMatrix (); glPopMatrix ();
glPopAttrib (); glPopAttrib ();
#else #else
glViewport(viewport_dim[0], viewport_dim[1], viewport_dim[2], viewport_dim[3]); glViewport (viewport_dim[0], viewport_dim[1], viewport_dim[2],
viewport_dim[3]);
#endif #endif
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0); glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
@ -3022,15 +3019,15 @@ gst_gl_display_thread_do_download_draw_rgb (GstGLDisplay * display)
gint width = display->ouput_texture_width; gint width = display->ouput_texture_width;
gint height = display->ouput_texture_height; gint height = display->ouput_texture_height;
const GLfloat vVertices [] = const GLfloat vVertices[] = { 1.0f, -1.0f, 0.0f,
{1.0f, -1.0f, 0.0f,
1.0f, 0.0f, 1.0f, 0.0f,
-1.0f, -1.0f, 0.0f, -1.0f, -1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f,
-1.0f, 1.0f, 0.0f, -1.0f, 1.0f, 0.0f,
0.0f, 1.0f, 0.0f, 1.0f,
1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f,
1.0f, 1.0f}; 1.0f, 1.0f
};
GLushort indices[] = { 0, 1, 2, 0, 2, 3 }; GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
@ -3070,8 +3067,7 @@ gst_gl_display_thread_do_download_draw_rgb (GstGLDisplay * display)
glGetTexImage (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, glGetTexImage (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA,
GL_UNSIGNED_BYTE, data); GL_UNSIGNED_BYTE, data);
#else #else
glReadPixels (0, 0, width, height, GL_RGBA, glReadPixels (0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, data);
GL_UNSIGNED_BYTE, data);
#endif #endif
break; break;
case GST_VIDEO_FORMAT_BGRx: case GST_VIDEO_FORMAT_BGRx:
@ -3088,8 +3084,7 @@ gst_gl_display_thread_do_download_draw_rgb (GstGLDisplay * display)
glGetTexImage (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB, glGetTexImage (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB,
GL_UNSIGNED_BYTE, data); GL_UNSIGNED_BYTE, data);
#else #else
glReadPixels (0, 0, width, height, GL_RGB, glReadPixels (0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, data);
GL_UNSIGNED_BYTE, data);
#endif #endif
break; break;
case GST_VIDEO_FORMAT_BGR: case GST_VIDEO_FORMAT_BGR:
@ -3116,15 +3111,15 @@ gst_gl_display_thread_do_download_draw_yuv (GstGLDisplay * display)
#ifdef OPENGL_ES2 #ifdef OPENGL_ES2
GLint viewport_dim[4]; GLint viewport_dim[4];
const GLfloat vVertices [] = const GLfloat vVertices[] = { 1.0f, -1.0f, 0.0f,
{1.0f, -1.0f, 0.0f,
1.0f, 0.0f, 1.0f, 0.0f,
-1.0f, -1.0f, 0.0f, -1.0f, -1.0f, 0.0f,
0.0f, .0f, 0.0f, .0f,
-1.0f, 1.0f, 0.0f, -1.0f, 1.0f, 0.0f,
0.0f, 1.0f, 0.0f, 1.0f,
1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f,
1.0f, 1.0f}; 1.0f, 1.0f
};
GLushort indices[] = { 0, 1, 2, 0, 2, 3 }; GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
#endif #endif
@ -3286,7 +3281,8 @@ gst_gl_display_thread_do_download_draw_yuv (GstGLDisplay * display)
glPopMatrix (); glPopMatrix ();
glPopAttrib (); glPopAttrib ();
#else #else
glViewport(viewport_dim[0], viewport_dim[1], viewport_dim[2], viewport_dim[3]); glViewport (viewport_dim[0], viewport_dim[1], viewport_dim[2],
viewport_dim[3]);
#endif #endif
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0); glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);