#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 <X11/Xlib.h>
+# include <GL/gl.h>
+# include <GL/glu.h>
+#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"
/* filled sphere */
static Bool mySphere(float radius)
{
+#if 0
GLUquadricObj *quadObj;
if((quadObj = gluNewQuadric()) == 0)
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;
}
/* textured sphere */
static Bool mySphereTex(float radius)
{
+#if 0
GLUquadricObj *quadObj;
if((quadObj = gluNewQuadric()) == 0)
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;
}
/* filled cone */
static Bool myCone(float radius)
{
+#if 0
GLUquadricObj *quadObj;
if ((quadObj = gluNewQuadric()) == 0)
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;
}
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);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
+ device_rotate(mi);
glPushMatrix();
/* started ? -mag : -8.0 + 4.0*fabs(sin(ant_step/10.0)), */
/* started ? -mag : -8.0 + 4.0*fabs(sin(ant_step/10.0))); */
+ glRotatef(-current_device_rotation(), 0, 0, 1);
gltrackball_rotate(mp->trackball);
+ glRotatef(current_device_rotation(), 0, 0, 1);
glRotatef(mp->ant_step*0.6, 0.0, 1.0, 0.0);
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);
glTranslatef(0.0, 0.0, -16.0);
glRotatef(60.0, 1.0, 0.0, 0.0);
glRotatef(-15.0 + mp->ant_step/10.0, 0.0, 1.0, 0.0);
+ glRotatef(-current_device_rotation(), 0, 0, 1);
gltrackball_rotate(mp->trackball);
+ glRotatef(current_device_rotation(), 0, 0, 1);
/* sync */
if(!draw_antmaze_strip(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);
/* 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);