*
* REVISION HISTORY:
* C. Steger - 14/01/03: Initial version
+ * C. Steger - 14/10/03: Moved the curlicue texture to curlicue.h
*/
/*
* Dimensions", Scientific American Library, 1990.
*/
+#include "curlicue.h"
+
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
"*showFPS: False \n" \
# define refresh_projectiveplane 0
+# define release_projectiveplane 0
# include "xlockmore.h" /* from the xscreensaver distribution */
#else /* !STANDALONE */
# include "xlock.h" /* from the xlockmore distribution */
#ifdef USE_GL
-#ifndef HAVE_COCOA
+#ifndef HAVE_JWXYZ
# include <X11/keysym.h>
#endif
#ifdef USE_MODULES
ModStruct projectiveplane_description =
{"projectiveplane", "init_projectiveplane", "draw_projectiveplane",
- "release_projectiveplane", "draw_projectiveplane", "change_projectiveplane",
+ NULL, "draw_projectiveplane", "change_projectiveplane",
NULL, &projectiveplane_opts, 25000, 1, 1, 1, 1.0, 4, "",
"Rotate a 4d embedding of the real projective plane in 4d or walk on it",
0, NULL};
static char *mode;
-static int display_mode;
static char *appear;
-static int appearance;
static char *color_mode;
-static int colors;
static char *view_mode;
-static int view;
static Bool marks;
static char *proj_3d;
-static int projection_3d;
static char *proj_4d;
-static int projection_4d;
static float speed_wx;
static float speed_wy;
static float speed_wz;
typedef struct {
GLint WindH, WindW;
GLXContext *glx_context;
+ /* Options */
+ int display_mode;
+ int appearance;
+ int colors;
+ int view;
+ Bool marks;
+ int projection_3d;
+ int projection_4d;
/* 4D rotation angles */
float alpha, beta, delta, zeta, eta, theta;
/* Movement parameters */
static projectiveplanestruct *projectiveplane = (projectiveplanestruct *) NULL;
-/* A texture map containing a "curlicue" */
-#define TEX_DIMENSION 64
-static const unsigned char texture[TEX_DIMENSION*TEX_DIMENSION] = {
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255, 58, 43, 43, 43, 43, 45, 70, 70, 70,
- 70, 70, 70, 70, 74, 98, 98, 98,100,194,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255, 18, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 30,186,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255, 18, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1,111,244,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255, 18, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 43,198,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255, 18, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 5,123,248,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255, 18, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 50,209,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,246,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255, 18, 0, 0, 0, 0, 0, 0, 0, 0,
- 74,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,138, 4,
- 66,229,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255, 18, 0, 0, 0, 0, 0, 0, 0, 0,
- 1,170,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,153, 0, 0,
- 0, 53,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255, 18, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 6,188,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,213, 7, 0, 0,
- 0, 0,226,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255, 45, 0, 0, 0, 0, 0, 47, 0, 0,
- 0, 0, 22,225,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,254, 54, 0, 0, 0,
- 0, 81,254,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255, 45, 0, 0, 0, 0, 56,247, 82, 0,
- 0, 0, 0, 59,253,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,152, 0, 0, 0, 0,
- 52,243,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255, 45, 0, 0, 0, 8,215,255,250, 56,
- 0, 0, 0, 0,142,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,241, 19, 0, 0, 0, 15,
- 220,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255, 45, 0, 0, 0,129,255,255,255,230,
- 23, 0, 0, 0, 12,230,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,131, 0, 0, 0, 0,157,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255, 45, 0, 0, 49,250,255,255,255,255,
- 171, 0, 0, 0, 0,112,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,246, 19, 0, 0, 0, 54,253,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255, 45, 0, 5,208,255,255,255,255,255,
- 255, 77, 0, 0, 0, 9,231,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,163, 0, 0, 0, 0,186,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255, 45, 0,121,255,255,255,255,255,255,
- 255,211, 2, 0, 0, 0,134,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255, 69, 0, 0, 0, 50,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255, 45, 41,247,255,255,255,255,255,255,
- 255,255, 73, 0, 0, 0, 38,254,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,237, 4, 0, 0, 0,145,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255, 52,201,255,255,255,255,255,255,255,
- 255,255,169, 0, 0, 0, 0,216,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,181, 0, 0, 0, 0,229,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,186,255,255,255,255,255,255,255,255,
- 255,255,247, 7, 0, 0, 0,150,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,130, 0, 0, 0, 42,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255, 67, 0, 0, 0, 91,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255, 79, 0, 0, 0, 95,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,120, 0, 0, 0, 56,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255, 55, 0, 0, 0,130,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,157, 0, 0, 0, 21,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255, 34, 0, 0, 0,161,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,179, 0, 0, 0, 2,250,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255, 27, 0, 0, 0,168,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,200, 0, 0, 0, 0,249,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255, 27, 0, 0, 0,168,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,200, 0, 0, 0, 0,249,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255, 27, 0, 0, 0,163,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,183, 0, 0, 0, 0,249,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255, 42, 0, 0, 0,135,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,161, 0, 0, 0, 17,254,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255, 76, 0, 0, 0,100,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,126, 0, 0, 0, 48,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,114, 0, 0, 0, 53,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255, 78, 0, 0, 0, 84,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,165, 0, 0, 0, 3,241,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,252, 16, 0, 0, 0,139,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,228, 0, 0, 0, 0,161,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,192, 0, 0, 0, 0,198,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255, 46, 0, 0, 0, 67,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255, 93, 0, 0, 0, 21,250,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,139, 0, 0, 0, 1,211,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,226, 7, 0, 0, 0,108,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,230, 6, 0, 0, 0, 79,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,106, 0, 0, 0, 1,206,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255, 97, 0, 0, 0, 0,183,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 202, 3, 0, 0, 0, 67,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,221, 8, 0, 0, 0, 27,
- 235,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,243,
- 40, 0, 0, 0, 0,198,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,126, 0, 0, 0, 0,
- 71,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,253, 85,
- 0, 0, 0, 0, 96,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,247, 44, 0, 0, 0,
- 0, 91,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,116, 0,
- 0, 0, 0, 25,233,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,216, 11, 0, 0,
- 0, 0, 90,251,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,252,112, 0, 0,
- 0, 0, 4,191,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,174, 4, 0,
- 0, 0, 0, 72,235,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,242, 84, 0, 0, 0,
- 0, 0,146,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,150, 1,
- 0, 0, 0, 0, 27,181,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,194, 39, 0, 0, 0, 0,
- 0,120,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,151,
- 4, 0, 0, 0, 0, 0, 77,209,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,216, 92, 1, 0, 0, 0, 0, 0,
- 125,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 175, 12, 0, 0, 0, 0, 0, 1, 70,164,241,255,255,255,255,255,
- 255,255,255,255,255,242,171, 77, 2, 0, 0, 0, 0, 0, 4,150,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,214, 41, 0, 0, 0, 0, 0, 0, 0, 4, 48, 98,138,163,163,
- 163,163,140,103, 55, 5, 0, 0, 0, 0, 0, 0, 0, 30,199,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,245,125, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,105,240,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,222,100, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 83,210,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,228,136, 45, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 37,125,220,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,225,166,112, 74, 43, 32, 12,
- 8, 32, 40, 71,105,162,218,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-};
-
-
/* Add a rotation around the wx-plane to the matrix m. */
static void rotatewx(float m[4][4], float phi)
{
/* Compute a fully saturated and bright color based on an angle. */
-static void color(double angle, float col[4])
+static void color(projectiveplanestruct *pp, double angle, float col[4])
{
int s;
double t;
- if (colors == COLORS_TWOSIDED)
+ if (pp->colors == COLORS_TWOSIDED)
return;
if (angle >= 0.0)
col[2] = 1.0-t;
break;
}
- if (display_mode == DISP_TRANSPARENT)
+ if (pp->display_mode == DISP_TRANSPARENT)
col[3] = 0.7;
else
col[3] = 1.0;
for (j=0; j<=NUMU; j++)
{
k = i*(NUMU+1)+j;
- if (appearance != APPEARANCE_DIRECTION_BANDS)
+ if (pp->appearance != APPEARANCE_DIRECTION_BANDS)
u = -ur*j/NUMU+umin;
else
u = ur*j/NUMU+umin;
sv2 = sin(0.5*v);
cv4 = cos(0.25*v);
sv4 = sin(0.25*v);
- if (colors == COLORS_DEPTH)
- color(((su*su*sv4*sv4-cv4*cv4)+1.0)*M_PI*2.0/3.0,pp->col[k]);
- else if (colors == COLORS_DIRECTION)
- color(2.0*M_PI+fmod(2.0*u,2.0*M_PI),pp->col[k]);
- else /* colors == COLORS_DISTANCE */
- color(v*(5.0/6.0),pp->col[k]);
+ if (pp->colors == COLORS_DEPTH)
+ color(pp,((su*su*sv4*sv4-cv4*cv4)+1.0)*M_PI*2.0/3.0,pp->col[k]);
+ else if (pp->colors == COLORS_DIRECTION)
+ color(pp,2.0*M_PI+fmod(2.0*u,2.0*M_PI),pp->col[k]);
+ else /* pp->colors == COLORS_DISTANCE */
+ color(pp,v*(5.0/6.0),pp->col[k]);
pp->tex[k][0] = -32*u/(2.0*M_PI);
- if (appearance != APPEARANCE_DISTANCE_BANDS)
+ if (pp->appearance != APPEARANCE_DISTANCE_BANDS)
pp->tex[k][1] = 32*v/(2.0*M_PI);
else
pp->tex[k][1] = 32*v/(2.0*M_PI)-0.5;
float q1[4], q2[4], r1[4][4], r2[4][4];
projectiveplanestruct *pp = &projectiveplane[MI_SCREEN(mi)];
- if (view == VIEW_WALK || view == VIEW_WALKTURN)
+ if (pp->view == VIEW_WALK || pp->view == VIEW_WALKTURN)
{
/* Compute the rotation that rotates the projective plane in 4D without
the trackball rotations. */
yv[l] = (mat[l][0]*xxv[0]+mat[l][1]*xxv[1]+
mat[l][2]*xxv[2]+mat[l][3]*xxv[3]);
}
- if (projection_4d == DISP_4D_ORTHOGRAPHIC)
+ if (pp->projection_4d == DISP_4D_ORTHOGRAPHIC)
{
for (l=0; l<3; l++)
{
r += mat[l][m]*xx[m];
y[l] = r;
}
- if (projection_4d == DISP_4D_ORTHOGRAPHIC)
+ if (pp->projection_4d == DISP_4D_ORTHOGRAPHIC)
{
for (l=0; l<3; l++)
p[l] = y[l]+pp->offset4d[l];
yv[l] = (mat[l][0]*pp->xv[o][0]+mat[l][1]*pp->xv[o][1]+
mat[l][2]*pp->xv[o][2]+mat[l][3]*pp->xv[o][3]);
}
- if (projection_4d == DISP_4D_ORTHOGRAPHIC)
+ if (pp->projection_4d == DISP_4D_ORTHOGRAPHIC)
{
for (l=0; l<3; l++)
{
}
}
- if (colors == COLORS_TWOSIDED)
+ if (pp->colors == COLORS_TWOSIDED)
{
glColor3fv(mat_diff_red);
- if (display_mode == DISP_TRANSPARENT)
+ if (pp->display_mode == DISP_TRANSPARENT)
{
glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,mat_diff_trans_red);
glMaterialfv(GL_BACK,GL_AMBIENT_AND_DIFFUSE,mat_diff_trans_green);
}
glBindTexture(GL_TEXTURE_2D,pp->tex_name);
- if (appearance != APPEARANCE_DIRECTION_BANDS)
+ if (pp->appearance != APPEARANCE_DIRECTION_BANDS)
{
for (i=0; i<NUMV; i++)
{
- if (appearance == APPEARANCE_DISTANCE_BANDS &&
+ if (pp->appearance == APPEARANCE_DISTANCE_BANDS &&
((i & (NUMB-1)) >= NUMB/4) && ((i & (NUMB-1)) < 3*NUMB/4))
continue;
- if (display_mode == DISP_WIREFRAME)
+ if (pp->display_mode == DISP_WIREFRAME)
glBegin(GL_QUAD_STRIP);
else
glBegin(GL_TRIANGLE_STRIP);
o = l*(NUMU+1)+m;
glNormal3fv(pp->pn[o]);
glTexCoord2fv(pp->tex[o]);
- if (colors != COLORS_TWOSIDED)
+ if (pp->colors != COLORS_TWOSIDED)
{
glColor3fv(pp->col[o]);
glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE,pp->col[o]);
glEnd();
}
}
- else /* appearance == APPEARANCE_DIRECTION_BANDS */
+ else /* pp->appearance == APPEARANCE_DIRECTION_BANDS */
{
for (j=0; j<NUMU; j++)
{
if ((j & (NUMB-1)) >= NUMB/2)
continue;
- if (display_mode == DISP_WIREFRAME)
+ if (pp->display_mode == DISP_WIREFRAME)
glBegin(GL_QUAD_STRIP);
else
glBegin(GL_TRIANGLE_STRIP);
o = l*(NUMU+1)+m;
glNormal3fv(pp->pn[o]);
glTexCoord2fv(pp->tex[o]);
- if (colors != COLORS_TWOSIDED)
+ if (pp->colors != COLORS_TWOSIDED)
{
glColor3fv(pp->col[o]);
glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE,pp->col[o]);
if (walk_speed == 0.0)
walk_speed = 20.0;
- if (view == VIEW_TURN)
+ if (pp->view == VIEW_TURN)
{
pp->alpha = frand(360.0);
pp->beta = frand(360.0);
gen_texture(mi);
setup_projective_plane(mi,0.0,2.0*M_PI,0.0,2.0*M_PI);
- if (marks)
+ if (pp->marks)
glEnable(GL_TEXTURE_2D);
else
glDisable(GL_TEXTURE_2D);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- if (projection_3d == DISP_3D_PERSPECTIVE ||
- view == VIEW_WALK || view == VIEW_WALKTURN)
+ if (pp->projection_3d == DISP_3D_PERSPECTIVE ||
+ pp->view == VIEW_WALK || pp->view == VIEW_WALKTURN)
{
- if (view == VIEW_WALK || view == VIEW_WALKTURN)
+ if (pp->view == VIEW_WALK || pp->view == VIEW_WALKTURN)
gluPerspective(60.0,1.0,0.01,10.0);
else
gluPerspective(60.0,1.0,0.1,10.0);
glLoadIdentity();
# ifdef HAVE_JWZGLES /* #### glPolygonMode other than GL_FILL unimplemented */
- if (display_mode == DISP_WIREFRAME)
- display_mode = DISP_SURFACE;
+ if (pp->display_mode == DISP_WIREFRAME)
+ pp->display_mode = DISP_SURFACE;
# endif
- if (display_mode == DISP_SURFACE)
+ if (pp->display_mode == DISP_SURFACE)
{
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glDepthMask(GL_TRUE);
glDisable(GL_BLEND);
}
- else if (display_mode == DISP_TRANSPARENT)
+ else if (pp->display_mode == DISP_TRANSPARENT)
{
glDisable(GL_DEPTH_TEST);
glShadeModel(GL_SMOOTH);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
}
- else /* display_mode == DISP_WIREFRAME */
+ else /* pp->display_mode == DISP_WIREFRAME */
{
glDisable(GL_DEPTH_TEST);
glShadeModel(GL_FLAT);
if (!pp->button_pressed)
{
- if (view == VIEW_TURN)
+ if (pp->view == VIEW_TURN)
{
pp->alpha += speed_wx * pp->speed_scale;
if (pp->alpha >= 360.0)
if (pp->theta >= 360.0)
pp->theta -= 360.0;
}
- if (view == VIEW_WALKTURN)
+ if (pp->view == VIEW_WALKTURN)
{
pp->zeta += speed_xy * pp->speed_scale;
if (pp->zeta >= 360.0)
if (pp->theta >= 360.0)
pp->theta -= 360.0;
}
- if (view == VIEW_WALK || view == VIEW_WALKTURN)
+ if (pp->view == VIEW_WALK || pp->view == VIEW_WALKTURN)
{
pp->dvmove = (pp->dir*sin(walk_direction*M_PI/180.0)*
walk_speed*M_PI/4096.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- if (projection_3d == DISP_3D_PERSPECTIVE ||
- view == VIEW_WALK || view == VIEW_WALKTURN)
+ if (pp->projection_3d == DISP_3D_PERSPECTIVE ||
+ pp->view == VIEW_WALK || pp->view == VIEW_WALKTURN)
{
- if (view == VIEW_WALK || view == VIEW_WALKTURN)
+ if (pp->view == VIEW_WALK || pp->view == VIEW_WALKTURN)
gluPerspective(60.0,pp->aspect,0.01,10.0);
else
gluPerspective(60.0,pp->aspect,0.1,10.0);
{
projectiveplanestruct *pp;
- if (projectiveplane == NULL)
- {
- projectiveplane =
- (projectiveplanestruct *)calloc(MI_NUM_SCREENS(mi),
- sizeof(projectiveplanestruct));
- if (projectiveplane == NULL)
- return;
- }
+ MI_INIT(mi, projectiveplane, NULL);
pp = &projectiveplane[MI_SCREEN(mi)];
- pp->trackballs[0] = gltrackball_init();
- pp->trackballs[1] = gltrackball_init();
+ pp->trackballs[0] = gltrackball_init(True);
+ pp->trackballs[1] = gltrackball_init(True);
pp->current_trackball = 0;
pp->button_pressed = False;
/* Set the display mode. */
if (!strcasecmp(mode,"random"))
{
- display_mode = random() % NUM_DISPLAY_MODES;
+ pp->display_mode = random() % NUM_DISPLAY_MODES;
}
else if (!strcasecmp(mode,"wireframe"))
{
- display_mode = DISP_WIREFRAME;
+ pp->display_mode = DISP_WIREFRAME;
}
else if (!strcasecmp(mode,"surface"))
{
- display_mode = DISP_SURFACE;
+ pp->display_mode = DISP_SURFACE;
}
else if (!strcasecmp(mode,"transparent"))
{
- display_mode = DISP_TRANSPARENT;
+ pp->display_mode = DISP_TRANSPARENT;
}
else
{
- display_mode = random() % NUM_DISPLAY_MODES;
+ pp->display_mode = random() % NUM_DISPLAY_MODES;
}
/* Orientation marks don't make sense in wireframe mode. */
- if (display_mode == DISP_WIREFRAME)
- marks = False;
+ pp->marks = marks;
+ if (pp->display_mode == DISP_WIREFRAME)
+ pp->marks = False;
/* Set the appearance. */
if (!strcasecmp(appear,"random"))
{
- appearance = random() % NUM_APPEARANCES;
+ pp->appearance = random() % NUM_APPEARANCES;
}
else if (!strcasecmp(appear,"solid"))
{
- appearance = APPEARANCE_SOLID;
+ pp->appearance = APPEARANCE_SOLID;
}
else if (!strcasecmp(appear,"distance-bands"))
{
- appearance = APPEARANCE_DISTANCE_BANDS;
+ pp->appearance = APPEARANCE_DISTANCE_BANDS;
}
else if (!strcasecmp(appear,"direction-bands"))
{
- appearance = APPEARANCE_DIRECTION_BANDS;
+ pp->appearance = APPEARANCE_DIRECTION_BANDS;
}
else
{
- appearance = random() % NUM_APPEARANCES;
+ pp->appearance = random() % NUM_APPEARANCES;
}
/* Set the color mode. */
if (!strcasecmp(color_mode,"random"))
{
- colors = random() % NUM_COLORS;
+ pp->colors = random() % NUM_COLORS;
}
else if (!strcasecmp(color_mode,"two-sided"))
{
- colors = COLORS_TWOSIDED;
+ pp->colors = COLORS_TWOSIDED;
}
else if (!strcasecmp(color_mode,"distance"))
{
- colors = COLORS_DISTANCE;
+ pp->colors = COLORS_DISTANCE;
}
else if (!strcasecmp(color_mode,"direction"))
{
- colors = COLORS_DIRECTION;
+ pp->colors = COLORS_DIRECTION;
}
else if (!strcasecmp(color_mode,"depth"))
{
- colors = COLORS_DEPTH;
+ pp->colors = COLORS_DEPTH;
}
else
{
- colors = random() % NUM_COLORS;
+ pp->colors = random() % NUM_COLORS;
}
/* Set the view mode. */
if (!strcasecmp(view_mode,"random"))
{
- view = random() % NUM_VIEW_MODES;
+ pp->view = random() % NUM_VIEW_MODES;
}
else if (!strcasecmp(view_mode,"walk"))
{
- view = VIEW_WALK;
+ pp->view = VIEW_WALK;
}
else if (!strcasecmp(view_mode,"turn"))
{
- view = VIEW_TURN;
+ pp->view = VIEW_TURN;
}
else if (!strcasecmp(view_mode,"walk-turn"))
{
- view = VIEW_WALKTURN;
+ pp->view = VIEW_WALKTURN;
}
else
{
- view = random() % NUM_VIEW_MODES;
+ pp->view = random() % NUM_VIEW_MODES;
}
/* Set the 3d projection mode. */
if (!strcasecmp(proj_3d,"random"))
{
/* Orthographic projection only makes sense in turn mode. */
- if (view == VIEW_TURN)
- projection_3d = random() % NUM_DISP_3D_MODES;
+ if (pp->view == VIEW_TURN)
+ pp->projection_3d = random() % NUM_DISP_3D_MODES;
else
- projection_3d = DISP_3D_PERSPECTIVE;
+ pp->projection_3d = DISP_3D_PERSPECTIVE;
}
else if (!strcasecmp(proj_3d,"perspective"))
{
- projection_3d = DISP_3D_PERSPECTIVE;
+ pp->projection_3d = DISP_3D_PERSPECTIVE;
}
else if (!strcasecmp(proj_3d,"orthographic"))
{
- projection_3d = DISP_3D_ORTHOGRAPHIC;
+ pp->projection_3d = DISP_3D_ORTHOGRAPHIC;
}
else
{
/* Orthographic projection only makes sense in turn mode. */
- if (view == VIEW_TURN)
- projection_3d = random() % NUM_DISP_3D_MODES;
+ if (pp->view == VIEW_TURN)
+ pp->projection_3d = random() % NUM_DISP_3D_MODES;
else
- projection_3d = DISP_3D_PERSPECTIVE;
+ pp->projection_3d = DISP_3D_PERSPECTIVE;
}
/* Set the 4d projection mode. */
if (!strcasecmp(proj_4d,"random"))
{
- projection_4d = random() % NUM_DISP_4D_MODES;
+ pp->projection_4d = random() % NUM_DISP_4D_MODES;
}
else if (!strcasecmp(proj_4d,"perspective"))
{
- projection_4d = DISP_4D_PERSPECTIVE;
+ pp->projection_4d = DISP_4D_PERSPECTIVE;
}
else if (!strcasecmp(proj_4d,"orthographic"))
{
- projection_4d = DISP_4D_ORTHOGRAPHIC;
+ pp->projection_4d = DISP_4D_ORTHOGRAPHIC;
}
else
{
- projection_4d = random() % NUM_DISP_4D_MODES;
+ pp->projection_4d = random() % NUM_DISP_4D_MODES;
}
/* Modify the speeds to a useful range in walk-and-turn mode. */
- if (view == VIEW_WALKTURN)
+ if (pp->view == VIEW_WALKTURN)
{
speed_wx *= 0.2;
speed_wy *= 0.2;
}
-/*
- *-----------------------------------------------------------------------------
- * The display is being taken away from us. Free up malloc'ed
- * memory and X resources that we've alloc'ed. Only called
- * once, we must zap everything for every screen.
- *-----------------------------------------------------------------------------
- */
-
-ENTRYPOINT void release_projectiveplane(ModeInfo *mi)
-{
- if (projectiveplane != NULL)
- {
- int screen;
-
- for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++)
- {
- projectiveplanestruct *pp = &projectiveplane[screen];
-
- if (pp->glx_context)
- pp->glx_context = (GLXContext *)NULL;
- }
- (void) free((void *)projectiveplane);
- projectiveplane = (projectiveplanestruct *)NULL;
- }
- FreeAllGL(mi);
-}
-
#ifndef STANDALONE
ENTRYPOINT void change_projectiveplane(ModeInfo *mi)
{