1 #if !defined( lint ) && !defined( SABER )
2 static const char sccsid[] = "@(#)b_lockglue.c 4.11 98/06/16 xlockmore";
7 * BUBBLE3D (C) 1998 Richard W.M. Jones.
8 * b_lockglue.c: Glue to make this all work with xlockmore.
13 /* XXX This lot should eventually be made configurable using the
14 * options stuff below.
16 struct glb_config glb_config =
19 2, /* subdivision_depth */
21 3, /* subdivision_depth */
23 5, /* nr_nudge_axes */
24 0.3, /* nudge_angle_factor */
25 0.15, /* nudge_factor */
26 0.1, /* rotation_factor */
27 8, /* create_bubbles_every */
29 {0.7, 0.8, 0.9, 1.0}, /* p_bubble_group */
34 1.5, /* scale_factor */
35 -4, /* screen_bottom */
38 {0.1, 0.0, 0.4, 0.0}, /* bg_colour */
40 {0.0, 0.0, 0.0, 0.0}, /* bg_colour */
43 {0.7, 0.7, 0.0, 0.3} /* bubble_colour */
45 {0.0, 0.0, 0.7, 0.3} /* bubble_colour */
50 #define PROGCLASS "Bubble3D"
51 #define HACK_INIT init_bubble3d
52 #define HACK_RESHAPE reshape_bubble3d
53 #define HACK_DRAW draw_bubble3d
54 #define bubble3d_opts xlockmore_opts
56 # define DEFAULTS "*delay: 10000 \n" \
59 #include "xlockmore.h"
67 ModeSpecOpt bubble3d_opts =
68 {0, NULL, 0, NULL, NULL};
71 ModStruct bubbles3d_description =
80 1000, 1, 2, 1, 64, 1.0, "",
81 "Richard Jones's GL bubbles",
86 #endif /* USE_MODULES */
89 GLXContext *glx_context;
93 static struct context *contexts = 0;
96 init(struct context *c)
99 c->draw_context = glb_draw_init();
103 reshape_bubble3d(ModeInfo *mi, int w, int h)
105 glViewport(0, 0, (GLsizei) w, (GLsizei) h);
106 glMatrixMode(GL_PROJECTION);
108 gluPerspective(45, (GLdouble) w / (GLdouble) h, 3, 8);
109 glMatrixMode(GL_MODELVIEW);
111 glTranslatef(0, 0, -5);
115 do_display(struct context *c)
117 glb_draw_step(c->draw_context);
121 init_bubble3d(ModeInfo * mi)
123 Display *display = MI_DISPLAY(mi);
124 Window window = MI_WINDOW(mi);
125 int screen = MI_SCREEN(mi);
129 contexts = (struct context *) malloc(sizeof (struct context) * MI_NUM_SCREENS(mi));
134 c = &contexts[screen];
135 c->glx_context = init_GL(mi);
136 if (c->glx_context != 0) {
138 reshape_bubble3d(mi, MI_WIDTH(mi), MI_HEIGHT(mi));
141 glXSwapBuffers(display, window);
147 draw_bubble3d(ModeInfo * mi)
149 struct context *c = &contexts[MI_SCREEN(mi)];
150 Display *display = MI_DISPLAY(mi);
151 Window window = MI_WINDOW(mi);
153 MI_IS_DRAWN(mi) = True;
158 glXMakeCurrent(display, window, *(c->glx_context));
162 if (mi->fps_p) do_fps (mi);
164 glXSwapBuffers(display, window);
168 change_bubble3d(ModeInfo * mi)
174 release_bubble3d(ModeInfo * mi)
176 struct context *c = &contexts[MI_SCREEN(mi)];
179 glb_draw_end(c->draw_context);
180 (void) free((void *) contexts);