diff --git a/caca/driver_gl.c b/caca/driver_gl.c index 448f48c..79822ca 100644 --- a/caca/driver_gl.c +++ b/caca/driver_gl.c @@ -25,6 +25,10 @@ #include #include +#ifdef USE_GLUTCHECKLOOP +#define glutMainLoopEvent glutCheckLoop +#endif + #include #include #include @@ -73,6 +77,7 @@ static void gl_handle_special_key(int, int, int); static void gl_handle_reshape(int, int); static void gl_handle_mouse(int, int, int, int); static void gl_handle_mouse_motion(int, int); +static void _display(void); struct driver_private { @@ -146,6 +151,8 @@ static int gl_init_graphics(caca_t *kk) glutKeyboardFunc(gl_handle_keyboard); glutSpecialFunc(gl_handle_special_key); glutReshapeFunc(gl_handle_reshape); + glutDisplayFunc(_display); + glutMouseFunc(gl_handle_mouse); glutMotionFunc(gl_handle_mouse_motion); @@ -223,6 +230,7 @@ static unsigned int gl_get_window_height(caca_t *kk) return kk->drv.p->height; } + static void gl_display(caca_t *kk) { unsigned int x, y, line; @@ -452,6 +460,15 @@ static void gl_handle_mouse_motion(int x, int y) kk->drv.p->mouse_changed = 1; } + + +static void _display(void) +{ + caca_t *kk = gl_kk; + gl_display(kk); +} + + /* * Driver initialisation */ diff --git a/configure.ac b/configure.ac index fe33ace..ecc17e7 100644 --- a/configure.ac +++ b/configure.ac @@ -152,6 +152,11 @@ if test "${enable_gl}" != "no"; then [ac_cv_my_have_gl="yes" AC_DEFINE(USE_GL, 1, Define to 1 to activate the OpenGL backend driver) CACA_LIBS="${CACA_LIBS} -lGL -lglut" + CACA_DRIVERS="${CACA_DRIVERS} gl"])] + [AC_CHECK_LIB(glut, glutCheckLoop, + [ac_cv_my_have_gl="yes" + AC_DEFINE(USE_GLUTCHECKLOOP, 1, Define to 1 to activate the glut3 glutCheckLoop call) + CACA_LIBS="${CACA_LIBS} -lGL -lglut" CACA_DRIVERS="${CACA_DRIVERS} gl"])])]) if test "${ac_cv_my_have_gl}" = "no" -a "${enable_gl}" = "yes"; then AC_MSG_ERROR([cannot find OpenGL+FreeGLUT development files])