#include "xlock.h"
#endif
+#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 */
+
+#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;
}
/* silhouette sphere */
static Bool mySphere2(float radius)
{
+#if 0
GLUquadricObj *quadObj;
if((quadObj = gluNewQuadric()) == 0)
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;
}
static void pinit(void)
{
glClearDepth(1.0);
- glClearColor(0.0, 0.0, 0.0, 1.0);
-
+
/* setup twoside lighting */
glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
{
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
}
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));
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
+ glRotatef(current_device_rotation(), 0, 0, 1);
/* position camera */