2 static const char sccsid[] = "@(#)b_lockglue.c 4.11 98/06/16 xlockmore";
6 * BUBBLE3D (C) 1998 Richard W.M. Jones.
7 * b_lockglue.c: Glue to make this all work with xlockmore.
12 /* XXX This lot should eventually be made configurable using the
13 * options stuff below.
15 struct glb_config glb_config =
18 2, /* subdivision_depth */
20 3, /* subdivision_depth */
22 5, /* nr_nudge_axes */
23 0.3, /* nudge_angle_factor */
24 0.15, /* nudge_factor */
25 0.1, /* rotation_factor */
26 8, /* create_bubbles_every */
28 {0.7, 0.8, 0.9, 1.0}, /* p_bubble_group */
33 1.5, /* scale_factor */
34 -4, /* screen_bottom */
37 {0.1, 0.0, 0.4, 0.0}, /* bg_colour */
39 {0.0, 0.0, 0.0, 0.0}, /* bg_colour */
42 {0.7, 0.7, 0.0, 0.3} /* bubble_colour */
44 {0.0, 0.0, 0.7, 0.3} /* bubble_colour */
49 #define PROGCLASS "Bubble3D"
50 #define HACK_INIT init_bubble3d
51 #define HACK_RESHAPE reshape_bubble3d
52 #define HACK_DRAW draw_bubble3d
53 #define bubble3d_opts xlockmore_opts
55 # define DEFAULTS "*delay: 10000 \n" \
58 #include "xlockmore.h"
66 ModeSpecOpt bubble3d_opts =
67 {0, NULL, 0, NULL, NULL};
70 ModStruct bubbles3d_description =
79 1000, 1, 2, 1, 64, 1.0, "",
80 "Richard Jones's GL bubbles",
85 #endif /* USE_MODULES */
88 GLXContext *glx_context;
92 static struct context *contexts = 0;
95 init(struct context *c)
98 c->draw_context = glb_draw_init();
102 reshape_bubble3d(ModeInfo *mi, int w, int h)
104 glViewport(0, 0, (GLsizei) w, (GLsizei) h);
105 glMatrixMode(GL_PROJECTION);
107 gluPerspective(45, (GLdouble) w / (GLdouble) h, 3, 8);
108 glMatrixMode(GL_MODELVIEW);
110 glTranslatef(0, 0, -5);
114 do_display(struct context *c)
116 glb_draw_step(c->draw_context);
120 init_bubble3d(ModeInfo * mi)
122 Display *display = MI_DISPLAY(mi);
123 Window window = MI_WINDOW(mi);
124 int screen = MI_SCREEN(mi);
128 contexts = (struct context *) malloc(sizeof (struct context) * MI_NUM_SCREENS(mi));
133 c = &contexts[screen];
134 c->glx_context = init_GL(mi);
135 if (c->glx_context != 0) {
137 reshape_bubble3d(mi, MI_WIDTH(mi), MI_HEIGHT(mi));
140 glXSwapBuffers(display, window);
146 draw_bubble3d(ModeInfo * mi)
148 struct context *c = &contexts[MI_SCREEN(mi)];
149 Display *display = MI_DISPLAY(mi);
150 Window window = MI_WINDOW(mi);
152 MI_IS_DRAWN(mi) = True;
157 glXMakeCurrent(display, window, *(c->glx_context));
161 if (mi->fps_p) do_fps (mi);
163 glXSwapBuffers(display, window);
167 change_bubble3d(ModeInfo * mi)
173 release_bubble3d(ModeInfo * mi)
175 struct context *c = &contexts[MI_SCREEN(mi)];
178 glb_draw_end(c->draw_context);
179 (void) free((void *) contexts);