summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2016-03-10 00:24:48 +1100
committerMatthew Waters <matthew@centricular.com>2016-03-10 22:52:52 +1100
commit59da66f969857a3b6a67a9e1b5198d2263aedffc (patch)
tree46fe4094f5a1ff6f9a55f5057c1e467af98d7a58 /tests
parentbf6838d913d79c7374552a8b1b4d61c34edf1999 (diff)
gl/examples/cube*: choose opengl by default
The examples don't work with any other GL API. Also fix the yuv example to not translate the cube out of the clipping area.
Diffstat (limited to 'tests')
-rw-r--r--tests/examples/gl/generic/cube/main.cpp6
-rw-r--r--tests/examples/gl/generic/cubeyuv/main.cpp26
2 files changed, 16 insertions, 16 deletions
diff --git a/tests/examples/gl/generic/cube/main.cpp b/tests/examples/gl/generic/cube/main.cpp
index 3a54fe65b..da4aa1796 100644
--- a/tests/examples/gl/generic/cube/main.cpp
+++ b/tests/examples/gl/generic/cube/main.cpp
@@ -120,7 +120,8 @@ static gboolean drawCallback (GstElement * gl_sink, GstGLContext *context, GstSa
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
- glScalef(0.5f,0.5f,0.5f);
+ /* invert the y-axis to get the front face the correct way up */
+ glScalef (0.5f, -0.5f, 0.5f);
glRotatef(xrot,1.0f,0.0f,0.0f);
glRotatef(yrot,0.0f,1.0f,0.0f);
@@ -182,6 +183,9 @@ gint main (gint argc, gchar *argv[])
GMainLoop *loop;
GstBus *bus;
+ /* FIXME: remove once the example supports gl3 and/or gles2 */
+ g_setenv ("GST_GL_API", "opengl", FALSE);
+
/* initialization */
gst_init (&argc, &argv);
loop = g_main_loop_new (NULL, FALSE);
diff --git a/tests/examples/gl/generic/cubeyuv/main.cpp b/tests/examples/gl/generic/cubeyuv/main.cpp
index 9c4b2ccbd..cda990f8a 100644
--- a/tests/examples/gl/generic/cubeyuv/main.cpp
+++ b/tests/examples/gl/generic/cubeyuv/main.cpp
@@ -143,12 +143,13 @@ static gboolean drawCallback (GstElement * gl_sink, GstGLContext *context, GstSa
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
- glTranslatef(0.0f,0.0f,-5.0f);
-
glRotatef(xrot,1.0f,0.0f,0.0f);
glRotatef(yrot,0.0f,1.0f,0.0f);
glRotatef(zrot,0.0f,0.0f,1.0f);
+ /* invert the y-axis to get the front face the correct way up */
+ glScalef (0.5f, -0.5f, 0.5f);
+
glBegin(GL_QUADS);
// Front Face
glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
@@ -182,6 +183,8 @@ static gboolean drawCallback (GstElement * gl_sink, GstGLContext *context, GstSa
glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
glEnd();
+ glDisable(GL_DEPTH_TEST);
+
gst_video_frame_unmap (&v_frame);
xrot+=0.03f;
@@ -227,6 +230,9 @@ gint main (gint argc, gchar *argv[])
return -1;
}
+ /* FIXME: remove once the example supports gl3 and/or gles2 */
+ g_setenv ("GST_GL_API", "opengl", FALSE);
+
std::string video_location(argv[1]);
/* initialization */
@@ -247,22 +253,15 @@ gint main (gint argc, gchar *argv[])
GstElement* decodebin = gst_element_factory_make ("decodebin", "decodebin");
GstElement* identity = gst_element_factory_make ("identity", "identity0");
GstElement* textoverlay = gst_element_factory_make ("textoverlay", "textoverlay0");
- GstElement* glcolorscale = gst_element_factory_make ("glcolorscale", "glcolorscale0");
GstElement* glimagesink = gst_element_factory_make ("glimagesink", "glimagesink0");
- if (!videosrc || !decodebin || !identity || !textoverlay ||
- !glcolorscale || !glimagesink)
+ if (!videosrc || !decodebin || !identity || !textoverlay || !glimagesink)
{
g_print ("one element could not be found \n");
return -1;
}
- GstCaps *outcaps = gst_caps_new_simple("video/x-raw",
- "width", G_TYPE_INT, 640,
- "height", G_TYPE_INT, 480,
- NULL);
-
/* configure elements */
g_object_set(G_OBJECT(videosrc), "num-buffers", 800, NULL);
g_object_set(G_OBJECT(videosrc), "location", video_location.c_str(), NULL);
@@ -273,7 +272,7 @@ gint main (gint argc, gchar *argv[])
/* add elements */
gst_bin_add_many (GST_BIN (pipeline), videosrc, decodebin, identity,
- textoverlay, glcolorscale, glimagesink, NULL);
+ textoverlay, glimagesink, NULL);
/* link elements */
gst_element_link_pads (videosrc, "src", decodebin, "sink");
@@ -286,10 +285,7 @@ gint main (gint argc, gchar *argv[])
return -1;
}
- gst_element_link (textoverlay, glcolorscale);
-
- gboolean link_ok = gst_element_link_filtered(glcolorscale, glimagesink, outcaps) ;
- gst_caps_unref(outcaps) ;
+ gboolean link_ok = gst_element_link (textoverlay, glimagesink);
if(!link_ok)
{
g_warning("Failed to link textoverlay to glimagesink!\n") ;