From cabde245df11046f84ae16b7c60d9655d2c799e1 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Wed, 18 Jan 2012 15:54:59 +0100 Subject: [PATCH] test_output: use new drawing pipeline This converts the output test function to use the new kmscon_context for drawing operations so we no longer depend directly on GL. Signed-off-by: David Herrmann --- Makefile.am | 7 +------ tests/test_output.c | 31 +++++++++++++------------------ 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/Makefile.am b/Makefile.am index 4efc05f..ef94165 100644 --- a/Makefile.am +++ b/Makefile.am @@ -93,12 +93,7 @@ test_console_CPPFLAGS = \ $(OPENGL_CFLAGS) test_output_SOURCES = tests/test_output.c -test_output_LDADD = \ - libkmscon-core.la \ - $(OPENGL_LIBS) -test_output_CPPFLAGS = \ - $(AM_CPPFLAGS) \ - $(OPENGL_CFLAGS) +test_output_LDADD = libkmscon-core.la test_vt_SOURCES = tests/test_vt.c test_vt_LDADD = libkmscon-core.la diff --git a/tests/test_output.c b/tests/test_output.c index c1320f6..5157fb8 100644 --- a/tests/test_output.c +++ b/tests/test_output.c @@ -39,12 +39,10 @@ * * This would show a test screen on output 0 and 4: * $ ./test_output 0 4 - * The test screen is a white background with two gray triangles in the top-left - * and lower-right corner. + * The test screen is a colored quad with 4 different colors in each corner. */ -#define GL_GLEXT_PROTOTYPES - +#include #include #include #include @@ -52,11 +50,13 @@ #include #include -#include -#include #include "log.h" #include "output.h" +/* a colored quad */ +float d_vert[] = { 1, 1, -1, 1, -1, -1, 1, -1 }; +float d_col[] = { 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1 }; + static void sig_term(int sig) { } @@ -65,6 +65,11 @@ static int set_outputs(struct kmscon_compositor *comp, int num, char **list) { struct kmscon_output *iter; int i, j, val, ret; + struct kmscon_context *ctx; + + ctx = kmscon_compositor_get_context(comp); + if (!ctx) + return -EINVAL; j = 0; iter = kmscon_compositor_get_outputs(comp); @@ -102,18 +107,8 @@ static int set_outputs(struct kmscon_compositor *comp, int num, char **list) continue; } - glClearColor(1.0, 1.0, 1.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor4f(0.5, 0.5, 0.5, 1.0); - glVertex3f(1.0, 1.0, 0.0f); - glVertex3f(0, 0, 0.0f); - glVertex3f(1.0, 0, 0.0f); - glVertex3f(-1.0, -1.0, 0.0f); - glVertex3f(0, 0, 0.0f); - glVertex3f(-1.0, 0, 0.0f); - glEnd(); + kmscon_context_clear(ctx); + kmscon_context_draw_def(ctx, d_vert, d_col, 4); ret = kmscon_output_swap(iter); if (ret) {