X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fpinion.c;h=4da81e39a3e6997c54170875264e20a34c5c60f9;hb=6f5482d73adb0165c0130bb47d852644ab0c4869;hp=b18eb73cc5c1658fce1b1a24b9e70d4a1af0abd8;hpb=488f2fa8fbdbc77e91a70da2962d73af49e6cace;p=xscreensaver diff --git a/hacks/glx/pinion.c b/hacks/glx/pinion.c index b18eb73c..4da81e39 100644 --- a/hacks/glx/pinion.c +++ b/hacks/glx/pinion.c @@ -1,4 +1,4 @@ -/* pinion, Copyright (c) 2004-2006 Jamie Zawinski +/* pinion, Copyright (c) 2004-2012 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -12,9 +12,9 @@ #define DEFAULTS "*delay: 15000 \n" \ "*showFPS: False \n" \ "*wireframe: False \n" \ - "*titleFont: -*-times-bold-r-normal-*-180-*\n" \ - "*titleFont2: -*-times-bold-r-normal-*-120-*\n" \ - "*titleFont3: -*-times-bold-r-normal-*-80-*\n" \ + "*titleFont: -*-helvetica-medium-r-normal-*-180-*\n" \ + "*titleFont2: -*-helvetica-medium-r-normal-*-120-*\n" \ + "*titleFont3: -*-helvetica-medium-r-normal-*-80-*\n" \ # define refresh_pinion 0 # define release_pinion 0 @@ -53,8 +53,13 @@ typedef struct { Bool button_down_p; unsigned long mouse_gear_id; +# ifdef HAVE_GLBITMAP XFontStruct *xfont1, *xfont2, *xfont3; GLuint font1_dlist, font2_dlist, font3_dlist; +# else + texture_font_data *font1, *font2, *font3; +# endif + GLuint title_list; int draw_tick; @@ -109,9 +114,15 @@ static void load_fonts (ModeInfo *mi) { pinion_configuration *pp = &pps[MI_SCREEN(mi)]; +# ifdef HAVE_GLBITMAP load_font (mi->dpy, "titleFont", &pp->xfont1, &pp->font1_dlist); load_font (mi->dpy, "titleFont2", &pp->xfont2, &pp->font2_dlist); load_font (mi->dpy, "titleFont3", &pp->xfont3, &pp->font3_dlist); +# else + pp->font1 = load_texture_font (mi->dpy, "titleFont"); + pp->font2 = load_texture_font (mi->dpy, "titleFont2"); + pp->font3 = load_texture_font (mi->dpy, "titleFont3"); +# endif } @@ -152,20 +163,41 @@ new_label (ModeInfo *mi) glNewList (pp->title_list, GL_COMPILE); if (*label) { +# ifdef HAVE_GLBITMAP XFontStruct *f; GLuint fl; +# else + texture_font_data *fd; +# endif if (MI_WIDTH(mi) >= 500 && MI_HEIGHT(mi) >= 375) +# ifdef HAVE_GLBITMAP f = pp->xfont1, fl = pp->font1_dlist; /* big font */ +# else + fd = pp->font1; +# endif else if (MI_WIDTH(mi) >= 350 && MI_HEIGHT(mi) >= 260) +# ifdef HAVE_GLBITMAP f = pp->xfont2, fl = pp->font2_dlist; /* small font */ +# else + fd = pp->font2; +# endif else +# ifdef HAVE_GLBITMAP f = pp->xfont3, fl = pp->font3_dlist; /* tiny font */ +# else + fd = pp->font3; +# endif glColor3f (0.8, 0.8, 0); - print_gl_string (mi->dpy, f, fl, + print_gl_string (mi->dpy, +# ifdef HAVE_GLBITMAP + f, fl, +# else + fd, +# endif mi->xgwa.width, mi->xgwa.height, 10, mi->xgwa.height - 10, - label); + label, False); } glEndList (); } @@ -883,6 +915,7 @@ push_gear (ModeInfo *mi) if (g->coax_p) { + if (!parent) abort(); if (g->x != parent->x) abort(); if (g->y != parent->y) abort(); if (g->z == parent->z) abort(); @@ -1159,6 +1192,9 @@ static void find_mouse_gear (ModeInfo *mi) { pinion_configuration *pp = &pps[MI_SCREEN(mi)]; + +# ifndef HAVE_JWZGLES + int screen_width = MI_WIDTH (mi); int screen_height = MI_HEIGHT (mi); GLfloat h = (GLfloat) screen_height / (GLfloat) screen_width; @@ -1226,6 +1262,14 @@ find_mouse_gear (ModeInfo *mi) pp->mouse_gear_id = pnames[0]; } } + +#else /* HAVE_JWZGLES */ + /* #### not yet implemented */ + pp->mouse_gear_id = pp->gears[1]->id; + return; +#endif /* HAVE_JWZGLES */ + + } @@ -1295,7 +1339,9 @@ pinion_handle_event (ModeInfo *mi, XEvent *event) } else if (event->xany.type == ButtonPress && (event->xbutton.button == Button4 || - event->xbutton.button == Button5)) + event->xbutton.button == Button5 || + event->xbutton.button == Button6 || + event->xbutton.button == Button7)) { gltrackball_mousewheel (pp->trackball, event->xbutton.button, 5, !!event->xbutton.state); @@ -1329,7 +1375,6 @@ ENTRYPOINT void init_pinion (ModeInfo *mi) { pinion_configuration *pp; - int wire = MI_IS_WIREFRAME(mi); if (!pps) { pps = (pinion_configuration *) @@ -1338,8 +1383,6 @@ init_pinion (ModeInfo *mi) fprintf(stderr, "%s: out of memory\n", progname); exit(1); } - - pp = &pps[MI_SCREEN(mi)]; } pp = &pps[MI_SCREEN(mi)]; @@ -1348,6 +1391,7 @@ init_pinion (ModeInfo *mi) load_fonts (mi); reshape_pinion (mi, MI_WIDTH(mi), MI_HEIGHT(mi)); + clear_gl_error(); /* WTF? sometimes "invalid op" from glViewport! */ pp->title_list = glGenLists (1); @@ -1357,24 +1401,6 @@ init_pinion (ModeInfo *mi) pp->plane_displacement = gear_size * 0.1; - if (!wire) - { - GLfloat pos[4] = {-3.0, 1.0, 1.0, 0.0}; - GLfloat amb[4] = { 0.0, 0.0, 0.0, 1.0}; - GLfloat dif[4] = { 1.0, 1.0, 1.0, 1.0}; - GLfloat spc[4] = { 1.0, 1.0, 1.0, 1.0}; - - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - glEnable(GL_DEPTH_TEST); - glEnable(GL_CULL_FACE); - - glLightfv(GL_LIGHT0, GL_POSITION, pos); - glLightfv(GL_LIGHT0, GL_AMBIENT, amb); - glLightfv(GL_LIGHT0, GL_DIFFUSE, dif); - glLightfv(GL_LIGHT0, GL_SPECULAR, spc); - } - pp->trackball = gltrackball_init (); ffwd (mi); @@ -1394,6 +1420,27 @@ draw_pinion (ModeInfo *mi) glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(pp->glx_context)); + glPushMatrix(); + glRotatef(current_device_rotation(), 0, 0, 1); + + if (!wire_p) + { + GLfloat pos[4] = {-3.0, 1.0, 1.0, 0.0}; + GLfloat amb[4] = { 0.0, 0.0, 0.0, 1.0}; + GLfloat dif[4] = { 1.0, 1.0, 1.0, 1.0}; + GLfloat spc[4] = { 1.0, 1.0, 1.0, 1.0}; + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_DEPTH_TEST); + glEnable(GL_CULL_FACE); + + glLightfv(GL_LIGHT0, GL_POSITION, pos); + glLightfv(GL_LIGHT0, GL_AMBIENT, amb); + glLightfv(GL_LIGHT0, GL_DIFFUSE, dif); + glLightfv(GL_LIGHT0, GL_SPECULAR, spc); + } + if (!pp->button_down_p) { if (!debug_one_gear_p || pp->ngears == 0) @@ -1474,6 +1521,7 @@ draw_pinion (ModeInfo *mi) glPopMatrix (); glCallList (pp->title_list); + glPopMatrix (); if (mi->fps_p) do_fps (mi); glFinish();