Пример #1
0
        protected void init_window(int width, int height)
        {
            visual_config = glx.visual_config (visual_config);
            int vid = visual_config.visual_id ();
            gl = glx.create_context (vid, display.default_screen_no, GL.NONE0);

            // FIXME share colormap
            Colormap colormap = new Colormap (display.default_root, vid, false);

            Window.Attributes attr = new Window.Attributes ();
            attr.set_colormap (colormap);

            // TODO use depth of x visual config instead of
            // `visual_config.buffer_size'?
            int depth = visual_config.buffer_size ();

            int more = Event.EXPOSURE_MASK | Event.KEY_PRESS_MASK; // compulsory

            /* Bugs? Whenever button motion events are selected, it is required to
             * select button press event as well.
             */
             if ((event_mask & ANY_BUTTON_MOTION_BITS) != 0)
               more |= Event.BUTTON_PRESS_MASK;
             attr.set_event_mask (event_mask | more);

            window = new Window (display.default_root, 10, 10, width, height);
            window.create (5, depth, Window.INPUT_OUTPUT, vid, attr);

            window.set_wm (this, "main");
            window.set_wm_delete_window ();

            gl.make_current (window);
            glu = new GLU (gl);
            glut = new GLUT (glu);
        }