projects
/
xscreensaver
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
http://www.tienza.es/crux/src/www.jwz.org/xscreensaver/xscreensaver-5.05.tar.gz
[xscreensaver]
/
hacks
/
glx
/
boing.c
diff --git
a/hacks/glx/boing.c
b/hacks/glx/boing.c
index 2f86b42da0269c2575d759d346e74e14e590e3bd..cb09a049d17e99f32e2b230b2aa6e90958e63ec8 100644
(file)
--- a/
hacks/glx/boing.c
+++ b/
hacks/glx/boing.c
@@
-1,4
+1,4
@@
-/* boing, Copyright (c) 2005 Jamie Zawinski <jwz@jwz.org>
+/* boing, Copyright (c) 2005
-2008
Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@
-21,22
+21,26
@@
* does not, obviously.
*/
* does not, obviously.
*/
-#include <X11/Intrinsic.h>
+#define DEFAULTS "*delay: 30000 \n" \
+ "*showFPS: False \n" \
+ "*wireframe: False \n" \
+
+# define refresh_boing 0
+# define release_boing 0
+#undef countof
+#define countof(x) (sizeof((x))/sizeof((*x)))
+
+#include "xlockmore.h"
+#include "gltrackball.h"
+#include <ctype.h>
-extern XtAppContext app;
+#ifdef USE_GL /* whole file */
-#define PROGCLASS "Boing"
-#define HACK_INIT init_boing
-#define HACK_DRAW draw_boing
-#define HACK_RESHAPE reshape_boing
-#define HACK_HANDLE_EVENT boing_handle_event
-#define EVENT_MASK PointerMotionMask
-#define sws_opts xlockmore_opts
#define DEF_SPIN "True"
#define DEF_LIGHTING "False"
#define DEF_SMOOTH "False"
#define DEF_SPIN "True"
#define DEF_LIGHTING "False"
#define DEF_SMOOTH "False"
-#define DEF_SCANLINES "
Fals
e"
+#define DEF_SCANLINES "
Tru
e"
#define DEF_SPEED "1.0"
#define DEF_SIZE "0.5"
#define DEF_ANGLE "15"
#define DEF_SPEED "1.0"
#define DEF_SIZE "0.5"
#define DEF_ANGLE "15"
@@
-51,21
+55,6
@@
extern XtAppContext app;
#define DEF_SHADOW_COLOR "#303030"
#define DEF_BACKGROUND "#8C8C8C"
#define DEF_SHADOW_COLOR "#303030"
#define DEF_BACKGROUND "#8C8C8C"
-#define DEFAULTS "*delay: 30000 \n" \
- "*showFPS: False \n" \
- "*wireframe: False \n" \
-
-#undef countof
-#define countof(x) (sizeof((x))/sizeof((*x)))
-
-#include "xlockmore.h"
-#include "gltrackball.h"
-#include <ctype.h>
-
-#ifdef USE_GL /* whole file */
-
-#include <GL/glu.h>
-
typedef struct { GLfloat x, y, z; } XYZ;
typedef struct {
typedef struct { GLfloat x, y, z; } XYZ;
typedef struct {
@@
-142,7
+131,7
@@
static argtype vars[] = {
{&bg_str, "boingBackground", "Background", DEF_BACKGROUND, t_String},
};
{&bg_str, "boingBackground", "Background", DEF_BACKGROUND, t_String},
};
-
ModeSpecOpt sws
_opts = {countof(opts), opts, countof(vars), vars, NULL};
+
ENTRYPOINT ModeSpecOpt boing
_opts = {countof(opts), opts, countof(vars), vars, NULL};
static void
parse_color (ModeInfo *mi, const char *name, const char *s, GLfloat *a)
static void
parse_color (ModeInfo *mi, const char *name, const char *s, GLfloat *a)
@@
-205,14
+194,14
@@
draw_box (ModeInfo *mi)
/* boing_configuration *bp = &bps[MI_SCREEN(mi)]; */
glPushMatrix();
glTranslatef (0, 0, -0.5);
/* boing_configuration *bp = &bps[MI_SCREEN(mi)]; */
glPushMatrix();
glTranslatef (0, 0, -0.5);
- glFrontFace (GL_CCW);
+/* glFrontFace (GL_CCW);*/
draw_grid (mi);
glPopMatrix();
glPushMatrix();
glRotatef (90, 1, 0, 0);
glTranslatef (0, 0, 0.5);
draw_grid (mi);
glPopMatrix();
glPushMatrix();
glRotatef (90, 1, 0, 0);
glTranslatef (0, 0, 0.5);
- glFrontFace (GL_CW);
+/* glFrontFace (GL_CW);*/
draw_grid (mi);
glPopMatrix();
}
draw_grid (mi);
glPopMatrix();
}
@@
-458,7
+447,7
@@
tick_physics (ModeInfo *mi)
/* Window management, etc
*/
/* Window management, etc
*/
-void
+
ENTRYPOINT
void
reshape_boing (ModeInfo *mi, int width, int height)
{
GLfloat h = (GLfloat) height / (GLfloat) width;
reshape_boing (ModeInfo *mi, int width, int height)
{
GLfloat h = (GLfloat) height / (GLfloat) width;
@@
-482,7
+471,7
@@
reshape_boing (ModeInfo *mi, int width, int height)
}
}
-Bool
+
ENTRYPOINT
Bool
boing_handle_event (ModeInfo *mi, XEvent *event)
{
boing_configuration *bp = &bps[MI_SCREEN(mi)];
boing_handle_event (ModeInfo *mi, XEvent *event)
{
boing_configuration *bp = &bps[MI_SCREEN(mi)];
@@
-504,7
+493,9
@@
boing_handle_event (ModeInfo *mi, XEvent *event)
}
else if (event->xany.type == ButtonPress &&
(event->xbutton.button == Button4 ||
}
else if (event->xany.type == ButtonPress &&
(event->xbutton.button == Button4 ||
- event->xbutton.button == Button5))
+ event->xbutton.button == Button5 ||
+ event->xbutton.button == Button6 ||
+ event->xbutton.button == Button7))
{
gltrackball_mousewheel (bp->trackball, event->xbutton.button, 10,
!!event->xbutton.state);
{
gltrackball_mousewheel (bp->trackball, event->xbutton.button, 10,
!!event->xbutton.state);
@@
-523,7
+514,7
@@
boing_handle_event (ModeInfo *mi, XEvent *event)
}
}
-void
+
ENTRYPOINT
void
init_boing (ModeInfo *mi)
{
boing_configuration *bp;
init_boing (ModeInfo *mi)
{
boing_configuration *bp;
@@
-614,7
+605,7
@@
init_boing (ModeInfo *mi)
}
}
-void
+
ENTRYPOINT
void
draw_boing (ModeInfo *mi)
{
boing_configuration *bp = &bps[MI_SCREEN(mi)];
draw_boing (ModeInfo *mi)
{
boing_configuration *bp = &bps[MI_SCREEN(mi)];
@@
-624,13
+615,13
@@
draw_boing (ModeInfo *mi)
if (!bp->glx_context)
return;
if (!bp->glx_context)
return;
+ glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(bp->glx_context));
+
mi->polygon_count = 0;
glShadeModel(GL_SMOOTH);
glEnable(GL_NORMALIZE);
mi->polygon_count = 0;
glShadeModel(GL_SMOOTH);
glEnable(GL_NORMALIZE);
- glEnable(GL_CULL_FACE);
- glEnable (GL_DEPTH_TEST);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@
-642,8
+633,20
@@
draw_boing (ModeInfo *mi)
glLightfv (GL_LIGHT0, GL_POSITION, bp->lightpos);
glLightfv (GL_LIGHT0, GL_POSITION, bp->lightpos);
+ glDisable (GL_CULL_FACE);
+ glDisable (GL_DEPTH_TEST);
+
+ glEnable (GL_LINE_SMOOTH);
+ glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);
+ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable (GL_BLEND);
+
draw_box (mi);
draw_shadow (mi);
draw_box (mi);
draw_shadow (mi);
+
+ glEnable (GL_CULL_FACE);
+ glEnable (GL_DEPTH_TEST);
+
draw_ball (mi);
if (scanlines_p)
draw_scanlines (mi);
draw_ball (mi);
if (scanlines_p)
draw_scanlines (mi);
@@
-656,4
+659,6
@@
draw_boing (ModeInfo *mi)
glXSwapBuffers(dpy, window);
}
glXSwapBuffers(dpy, window);
}
+XSCREENSAVER_MODULE ("Boing", boing)
+
#endif /* USE_GL */
#endif /* USE_GL */