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_DRAW draw_bubble3d
53 #define bubble3d_opts xlockmore_opts
55 #include "xlockmore.h"
63 ModeSpecOpt bubble3d_opts =
64 {0, NULL, 0, NULL, NULL};
67 ModStruct bubbles3d_description =
76 1000, 1, 2, 1, 64, 1.0, "",
77 "Richard Jones's GL bubbles",
82 #endif /* USE_MODULES */
85 GLXContext *glx_context;
89 static struct context *contexts = 0;
92 init(struct context *c)
95 c->draw_context = glb_draw_init();
101 glViewport(0, 0, (GLsizei) w, (GLsizei) h);
102 glMatrixMode(GL_PROJECTION);
104 gluPerspective(45, (GLdouble) w / (GLdouble) h, 3, 8);
105 glMatrixMode(GL_MODELVIEW);
107 glTranslatef(0, 0, -5);
111 do_display(struct context *c)
113 glb_draw_step(c->draw_context);
117 init_bubble3d(ModeInfo * mi)
119 Display *display = MI_DISPLAY(mi);
120 Window window = MI_WINDOW(mi);
121 int screen = MI_SCREEN(mi);
125 contexts = (struct context *) malloc(sizeof (struct context) * MI_NUM_SCREENS(mi));
130 c = &contexts[screen];
131 c->glx_context = init_GL(mi);
132 if (c->glx_context != 0) {
134 reshape(MI_WIDTH(mi), MI_HEIGHT(mi));
137 glXSwapBuffers(display, window);
143 draw_bubble3d(ModeInfo * mi)
145 struct context *c = &contexts[MI_SCREEN(mi)];
146 Display *display = MI_DISPLAY(mi);
147 Window window = MI_WINDOW(mi);
149 MI_IS_DRAWN(mi) = True;
154 glXMakeCurrent(display, window, *(c->glx_context));
159 glXSwapBuffers(display, window);
163 change_bubble3d(ModeInfo * mi)
169 release_bubble3d(ModeInfo * mi)
171 struct context *c = &contexts[MI_SCREEN(mi)];
174 glb_draw_end(c->draw_context);
175 (void) free((void *) contexts);