X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Ffps-gl.c;h=070ae6fb64f31b9226d857ae7c3036f9d0fd1b3e;hb=f8cf5ac7b2f53510f80a0eaf286a25298be17bfe;hp=59032aab8d1e66537c96f1ba1597961c49c70685;hpb=c1b9b55ad8d59dc05ef55e316aebf5863e7dfa56;p=xscreensaver diff --git a/hacks/glx/fps-gl.c b/hacks/glx/fps-gl.c index 59032aab..070ae6fb 100644 --- a/hacks/glx/fps-gl.c +++ b/hacks/glx/fps-gl.c @@ -1,4 +1,4 @@ -/* fps, Copyright (c) 2001-2008 Jamie Zawinski +/* fps, Copyright (c) 2001-2012 Jamie Zawinski * Draw a frames-per-second display (Xlib and OpenGL). * * Permission to use, copy, modify, distribute, and sell this software and its @@ -16,14 +16,15 @@ #ifdef HAVE_COCOA # include "jwxyz.h" -# include -# include -# include #else /* !HAVE_COCOA -- real Xlib */ # include # include #endif /* !HAVE_COCOA */ +#ifdef HAVE_JWZGLES +# include "jwzgles.h" +#endif /* HAVE_JWZGLES */ + #include "xlockmoreI.h" #include "fpsI.h" #include "glxfonts.h" @@ -36,6 +37,8 @@ extern void check_gl_error (const char *type); static void xlockmore_gl_fps_init (fps_state *st) { +#ifdef HAVE_GLBITMAP + XFontStruct *f = st->font; int first = f->min_char_or_byte2; int last = f->max_char_or_byte2; @@ -44,24 +47,16 @@ xlockmore_gl_fps_init (fps_state *st) st->font_dlist = glGenLists ((GLuint) last+1); check_gl_error ("glGenLists"); -# ifndef HAVE_COCOA + xscreensaver_glXUseXFont (st->dpy, f->fid, + first, last-first+1, st->font_dlist + first); + check_gl_error ("xscreensaver_glXUseXFont"); - glXUseXFont (f->fid, first, last-first+1, st->font_dlist + first); - check_gl_error ("glXUseXFont"); +#else /* !HAVE_GLBITMAP */ -# else /* HAVE_COCOA */ - { - AGLContext ctx = aglGetCurrentContext(); - int afid, face, size; - afid = jwxyz_font_info (f->fid, &size, &face); + clear_gl_error(); /* screw it */ + st->gl_fps_data = load_texture_font (st->dpy, "fpsFont"); - if (! aglUseFont (ctx, afid, face, size, - first, last-first+1, st->font_dlist + first)) { - check_gl_error ("aglUseFont"); - abort(); - } - } -# endif /* HAVE_COCOA */ +#endif /* !HAVE_GLBITMAP */ } @@ -79,7 +74,7 @@ xlockmore_gl_compute_fps (Display *dpy, Window w, fps_state *fpst, xlockmore_gl_fps_init (fpst); } - fps_compute (fpst, mi->polygon_count); + fps_compute (fpst, mi->polygon_count, mi->recursion_depth); } @@ -106,7 +101,12 @@ xlockmore_gl_draw_fps (ModeInfo *mi) y += lines*lh + st->font->descent; glColor3f (1, 1, 1); - print_gl_string (st->dpy, st->font, st->font_dlist, + print_gl_string (st->dpy, +# ifdef HAVE_GLBITMAP + st->font, st->font_dlist, +# else /* !HAVE_GLBITMAP */ + st->gl_fps_data, +# endif /* !HAVE_GLBITMAP */ xgwa.width, xgwa.height, st->x, y, st->string, st->clear_p); }