summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen W. Taylor <otaylor@fishsoup.net>2014-04-27 00:16:53 -0400
committerOwen W. Taylor <otaylor@fishsoup.net>2014-07-07 11:43:02 -0400
commit04a299aee0ffe1eae4a535247a054bea0b5ae658 (patch)
treefb5146aa10c7eac32a7dcecfa6b195aeaded3d82
parent21cd6b3c769096529798ac570e6a1b2dff3307f1 (diff)
downloadcogl-wip/quadbuffer-stereo.tar.gz
examples/cogl-texture-pixmap-x11: Add a --stereo command line optionwip/quadbuffer-stereo
If --stereo is passed, then the texture pixmap is created as a stereo texture pixmap, and also, if passed in conjunction with --gears, glxgears is also run with the -stereo option.
-rw-r--r--examples/cogl-x11-tfp.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/examples/cogl-x11-tfp.c b/examples/cogl-x11-tfp.c
index ea0a0b03..e8223b56 100644
--- a/examples/cogl-x11-tfp.c
+++ b/examples/cogl-x11-tfp.c
@@ -27,12 +27,13 @@
static pid_t gears_pid = 0;
static void
-spawn_gears (void)
+spawn_gears (CoglBool stereo)
{
pid_t pid = fork();
if (pid == 0)
execlp ("glxgears", "glxgears",
+ stereo ? "-stereo" : NULL,
NULL);
gears_pid = pid;
@@ -143,6 +144,7 @@ main (int argc, char **argv)
Atom atom_wm_delete_window;
int screen;
CoglBool gears = FALSE;
+ CoglBool stereo = FALSE;
Window tfp_xwin = None;
Pixmap pixmap;
CoglTexturePixmapX11 *tfp;
@@ -154,9 +156,11 @@ main (int argc, char **argv)
{
if (strcmp (argv[i], "--gears") == 0)
gears = TRUE;
+ else if (strcmp (argv[i], "--stereo") == 0)
+ stereo = TRUE;
else
{
- g_printerr ("Usage: cogl-x11-tfp [--gears]\n");
+ g_printerr ("Usage: cogl-x11-tfp [--gears] [--stereo]\n");
return 1;
}
}
@@ -188,7 +192,7 @@ main (int argc, char **argv)
if (gears)
{
- spawn_gears ();
+ spawn_gears (stereo);
while (TRUE)
{
tfp_xwin = find_gears_toplevel (xdpy, None);
@@ -320,7 +324,17 @@ main (int argc, char **argv)
pixmap = XCompositeNameWindowPixmap (xdpy, tfp_xwin);
- tfp = cogl_texture_pixmap_x11_new (ctx, pixmap, TRUE, &error);
+ if (stereo)
+ {
+ tfp = cogl_texture_pixmap_x11_new_left (ctx, pixmap, TRUE, &error);
+ if (tfp)
+ right_texture = cogl_texture_pixmap_x11_new_right (tfp);
+ }
+ else
+ {
+ tfp = cogl_texture_pixmap_x11_new (ctx, pixmap, TRUE, &error);
+ }
+
if (!tfp)
{
fprintf (stderr, "Failed to create CoglTexturePixmapX11: %s",