X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fantmaze.c;h=0ca7f05f433bc7f9042b05a2ba4379693f05b556;hb=6f5482d73adb0165c0130bb47d852644ab0c4869;hp=426be4311ea811fffd4294dbcfeab5eab0fffa96;hpb=5f9c47ca98dd43d8f59b7c27d3fde6edfde4fe21;p=xscreensaver diff --git a/hacks/glx/antmaze.c b/hacks/glx/antmaze.c index 426be431..0ca7f05f 100644 --- a/hacks/glx/antmaze.c +++ b/hacks/glx/antmaze.c @@ -22,18 +22,32 @@ static const char sccsid[] = "@(#)antmaze.c 5.01 2001/03/01 xlockmore"; #ifdef STANDALONE # define MODE_antmaze # define DEFAULTS "*delay: 20000 \n" \ - "*showFPS: False \n" + "*showFPS: False \n" \ + "*fpsSolid: True \n" # define refresh_antmaze 0 # include "xlockmore.h" /* from the xscreensaver distribution */ #else /* !STANDALONE */ # include "xlock.h" /* from the xlockmore distribution */ - #endif /* !STANDALONE */ +#ifdef HAVE_COCOA +# include "jwxyz.h" +#else +# include +# include +# include +#endif + +#ifdef HAVE_JWZGLES +# include "jwzgles.h" +#endif /* HAVE_JWZGLES */ + #ifdef MODE_antmaze +#include "sphere.h" +#include "tube.h" #include "rotator.h" #include "gltrackball.h" @@ -174,6 +188,7 @@ static const GLfloat position1[] = {-1.0, -5.0, 1.0, 1.0}; /* filled sphere */ static Bool mySphere(float radius) { +#if 0 GLUquadricObj *quadObj; if((quadObj = gluNewQuadric()) == 0) @@ -181,7 +196,13 @@ 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; } @@ -204,6 +225,7 @@ static Bool mySphere2(float radius) /* textured sphere */ static Bool mySphereTex(float radius) { +#if 0 GLUquadricObj *quadObj; if((quadObj = gluNewQuadric()) == 0) @@ -213,6 +235,13 @@ static Bool mySphereTex(float radius) gluQuadricNormals(quadObj, GLU_SMOOTH); gluSphere(quadObj, radius, 32, 16); gluDeleteQuadric(quadObj); +#else + glPushMatrix(); + glScalef (radius, radius, radius); + glRotatef (90, 1, 0, 0); + unit_sphere (32, 16, False); + glPopMatrix(); +#endif return True; } @@ -220,6 +249,7 @@ static Bool mySphereTex(float radius) /* filled cone */ static Bool myCone(float radius) { +#if 0 GLUquadricObj *quadObj; if ((quadObj = gluNewQuadric()) == 0) @@ -227,6 +257,12 @@ static Bool myCone(float radius) gluQuadricDrawStyle(quadObj, (GLenum) GLU_FILL); gluCylinder(quadObj, radius, 0, radius * 2, 8, 1); gluDeleteQuadric(quadObj); +#else + cone (0, 0, 0, + 0, 0, radius * 2, + radius, 0, + 8, True, True, False); +#endif return True; } @@ -1408,6 +1444,20 @@ ENTRYPOINT void init_antmaze(ModeInfo * mi) MI_CLEARWINDOW(mi); } +static void +device_rotate(ModeInfo *mi) +{ + GLfloat rot = current_device_rotation(); + glRotatef(rot, 0, 0, 1); + if ((rot > 45 && rot < 135) || + (rot < -45 && rot > -135)) + { + GLfloat s = MI_HEIGHT(mi) / (GLfloat) MI_WIDTH(mi); + glScalef (1/s, s, 1); + } +} + + ENTRYPOINT void draw_antmaze(ModeInfo * mi) { double h = (GLfloat) MI_HEIGHT(mi) / (GLfloat) MI_WIDTH(mi); @@ -1443,6 +1493,7 @@ ENTRYPOINT void draw_antmaze(ModeInfo * mi) glMatrixMode(GL_MODELVIEW); glLoadIdentity(); + device_rotate(mi); glPushMatrix(); @@ -1478,6 +1529,7 @@ ENTRYPOINT void draw_antmaze(ModeInfo * mi) glViewport((17*MI_WIDTH(mi))/32, MI_HEIGHT(mi)/2, MI_WIDTH(mi)/2, 3*MI_HEIGHT(mi)/8); glMatrixMode(GL_PROJECTION); glLoadIdentity(); + device_rotate(mi); gluPerspective(45, 1/h, 1, 25.0); glMatrixMode(GL_MODELVIEW); @@ -1500,6 +1552,7 @@ ENTRYPOINT void draw_antmaze(ModeInfo * mi) glViewport((5*MI_WIDTH(mi))/8, MI_HEIGHT(mi)/8, (11*MI_WIDTH(mi))/32, 3*MI_HEIGHT(mi)/8); glMatrixMode(GL_PROJECTION); glLoadIdentity(); + device_rotate(mi); gluPerspective(45, 1/h, 1, 25.0); glMatrixMode(GL_MODELVIEW); @@ -1564,7 +1617,10 @@ ENTRYPOINT void draw_antmaze(ModeInfo * mi) /* glPopMatrix(); */ /* glPopMatrix(); */ - if (MI_IS_FPS(mi)) do_fps (mi); + if (MI_IS_FPS(mi)) { + glViewport(0, 0, MI_WIDTH(mi), MI_HEIGHT(mi)); + do_fps (mi); + } glFlush(); glXSwapBuffers(display, window);