X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fantspotlight.c;h=a049976de0d4683cd1798fac13aa14d338570395;hb=aa75c7476aeaa84cf3abc192b376a8b03c325213;hp=30f2404d87d8866b0ab01e861c6bf938fca63ab2;hpb=5f9c47ca98dd43d8f59b7c27d3fde6edfde4fe21;p=xscreensaver diff --git a/hacks/glx/antspotlight.c b/hacks/glx/antspotlight.c index 30f2404d..a049976d 100644 --- a/hacks/glx/antspotlight.c +++ b/hacks/glx/antspotlight.c @@ -25,6 +25,20 @@ #include "xlock.h" #endif +#ifdef HAVE_JWXYZ +# include "jwxyz.h" +#else +# include +# include +# include +#endif + +#ifdef HAVE_JWZGLES +# include "jwzgles.h" +#endif /* HAVE_JWZGLES */ + +#include "sphere.h" +#include "tube.h" #include "rotator.h" #include "gltrackball.h" @@ -243,6 +257,7 @@ static Bool draw_ant(ModeInfo *mi, antspotlightstruct *mp, /* filled sphere */ static Bool mySphere(float radius) { +#if 0 GLUquadricObj *quadObj; if((quadObj = gluNewQuadric()) == 0) @@ -251,13 +266,20 @@ static Bool mySphere(float radius) gluQuadricDrawStyle(quadObj, (GLenum) GLU_FILL); gluSphere(quadObj, radius, 16, 16); gluDeleteQuadric(quadObj); - +#else + glPushMatrix(); + glScalef (radius, radius, radius); + glRotatef (90, 1, 0, 0); + unit_sphere (16, 16, False); + glPopMatrix(); +#endif return True; } /* silhouette sphere */ static Bool mySphere2(float radius) { +#if 0 GLUquadricObj *quadObj; if((quadObj = gluNewQuadric()) == 0) @@ -265,7 +287,14 @@ static Bool mySphere2(float radius) gluQuadricDrawStyle(quadObj, (GLenum) GLU_LINE); gluSphere(quadObj, radius, 16, 8); gluDeleteQuadric(quadObj); - +#else + /* #### no GLU_LINE */ + glPushMatrix(); + glScalef (radius, radius, radius); + glRotatef (90, 1, 0, 0); + unit_sphere (16, 16, True); + glPopMatrix(); +#endif return True; } @@ -609,51 +638,33 @@ ENTRYPOINT Bool antspotlight_handle_event(ModeInfo *mi, XEvent *event) { antspotlightstruct *mp = &antspotlight[MI_SCREEN(mi)]; - switch(event->xany.type) { - case ButtonPress: - - switch(event->xbutton.button) { - - case Button1: - mp->button_down_p = True; - gltrackball_start(mp->trackball, - event->xbutton.x, event->xbutton.y, - MI_WIDTH (mi), MI_HEIGHT (mi)); - break; + if (gltrackball_event_handler (event, mp->trackball, + MI_WIDTH (mi), MI_HEIGHT (mi), + &mp->button_down_p)) + return True; + + if (event->xany.type == ButtonPress) + { + switch(event->xbutton.button) { + + case Button1: + mp->button_down_p = True; + gltrackball_start(mp->trackball, + event->xbutton.x, event->xbutton.y, + MI_WIDTH (mi), MI_HEIGHT (mi)); + return True; - case Button4: - mp->mag = max(mp->mag-1, 1); - break; - - case Button5: - mp->mag = min(mp->mag+1, MAX_MAGNIFICATION); - break; - } - - break; - - case ButtonRelease: - - switch(event->xbutton.button) { - case Button1: - mp->button_down_p = False; - break; + case Button4: + mp->mag = max(mp->mag-1, 1); + return True; + + case Button5: + mp->mag = min(mp->mag+1, MAX_MAGNIFICATION); + return True; + } } - break; - - case MotionNotify: - if(mp->button_down_p) - gltrackball_track(mp->trackball, - event->xmotion.x, event->xmotion.y, - MI_WIDTH (mi), MI_HEIGHT (mi)); - break; - - default: - return False; - } - - return True; + return False; } static void @@ -704,7 +715,7 @@ ENTRYPOINT void init_antspotlight(ModeInfo *mi) } mp = &antspotlight[MI_SCREEN(mi)]; mp->rot = make_rotator (rot_speed, rot_speed, rot_speed, 1, 0, True); - mp->trackball = gltrackball_init (); + mp->trackball = gltrackball_init (False); if((mp->glx_context = init_GL(mi)) != NULL) { reshape_antspotlight(mi, MI_WIDTH(mi), MI_HEIGHT(mi)); @@ -751,6 +762,7 @@ ENTRYPOINT void draw_antspotlight(ModeInfo * mi) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); + glRotatef(current_device_rotation(), 0, 0, 1); /* position camera */