gl->GenTextures (1, &effects->midtexture[i]);
gl->BindTexture (GL_TEXTURE_2D, effects->midtexture[i]);
- gl->TexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8,
+ gl->TexImage2D (GL_TEXTURE_2D, 0,
+ gst_gl_internal_format_rgba (GST_GL_BASE_FILTER (filter)->context),
GST_VIDEO_INFO_WIDTH (&filter->out_info),
- GST_VIDEO_INFO_HEIGHT (&filter->out_info),
- 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ GST_VIDEO_INFO_HEIGHT (&filter->out_info), 0, GL_RGBA, GL_UNSIGNED_BYTE,
+ NULL);
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
static void
gst_gl_filtershader_init_resources (GstGLFilter * filter)
{
- glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8,
+ glTexImage2D (GL_TEXTURE_2D, 0,
+ gst_gl_internal_format_rgba (GST_GL_BASE_FILTER (filter)->context),
GST_VIDEO_INFO_WIDTH (&filter->out_info),
- GST_VIDEO_INFO_HEIGHT (&filter->out_info),
- 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ GST_VIDEO_INFO_HEIGHT (&filter->out_info), 0, GL_RGBA, GL_UNSIGNED_BYTE,
+ NULL);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
//FIXME:
#define GL_RGB16 GL_RGB565
#define GL_RGB8 GL_RGB
-#define GL_RGBA8 GL_RGBA
//END FIXME
/* UNSUPPORTED */
/* a fake texture is attached to the convert FBO (cannot init without it) */
gl->GenTextures (1, &fake_texture);
gl->BindTexture (GL_TEXTURE_2D, fake_texture);
- gl->TexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, out_width, out_height,
- 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ gl->TexImage2D (GL_TEXTURE_2D, 0,
+ gst_gl_internal_format_rgba (convert->context), out_width, out_height, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, NULL);
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
/* setup a texture to render to */
gl->GenTextures (1, &fake_texture);
gl->BindTexture (GL_TEXTURE_2D, fake_texture);
- gl->TexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8,
- width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ gl->TexImage2D (GL_TEXTURE_2D, 0,
+ gst_gl_internal_format_rgba (frame->context), width, height, 0, GL_RGBA,
+ GL_UNSIGNED_BYTE, NULL);
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
case GL_RGBA:
switch (type) {
case GL_UNSIGNED_BYTE:
- return GL_RGBA8;
+ return gst_gl_internal_format_rgba (context);
break;
}
break;
gl->BindTexture (GL_TEXTURE_2D, data->result);
if (data->width > 0 && data->height > 0)
- gl->TexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, data->width,
- data->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ gl->TexImage2D (GL_TEXTURE_2D, 0, gst_gl_internal_format_rgba (context),
+ data->width, data->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
case GST_VIDEO_FORMAT_xBGR:
case GST_VIDEO_FORMAT_AYUV:
{
- glinternalformat = GL_RGBA8;
+ glinternalformat = gst_gl_internal_format_rgba (context);
glformat = GL_RGBA;
gltype = GL_UNSIGNED_BYTE;
break;
return tmp;
}
+
+GLint
+gst_gl_internal_format_rgba (GstGLContext * context)
+{
+#if GST_GL_HAVE_GLES2 && (GST_GL_HAVE_OPENGL || GST_GL_HAVE_GLES3)
+ return USING_GLES2 (context) ? GL_RGBA : GL_RGBA8;
+#elif GST_GL_HAVE_OPENGL || GST_GL_HAVE_GLES3
+ return GL_RGBA8;
+#else
+ return GL_RGBA;
+#endif
+}
guint plane);
GstCaps * gst_gl_caps_replace_all_caps_features (const GstCaps * caps,
const gchar * feature_name);
+GLint gst_gl_internal_format_rgba (GstGLContext * context);
G_END_DECLS