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); }
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); }
public bool match(VisualConfig template) // TODO { if ((template.bitmask & VISUAL_BIT) != 0 && // exact template.visual_id() != visual_id()) { return(false); } if ((template.bitmask & CLASS_BIT) != 0 && // exact template.clazz() != clazz()) { return(false); } if ((template.bitmask & RGBA_BIT) != 0 && // exact !rgba()) { return(false); } if ((template.bitmask & RED_SIZE_BIT) != 0 && // larger template.red_size() > red_size()) { return(false); } if ((template.bitmask & GREEN_SIZE_BIT) != 0 && // larger template.green_size() > green_size()) { return(false); } if ((template.bitmask & BLUE_SIZE_BIT) != 0 && // larger template.blue_size() > blue_size()) { return(false); } if ((template.bitmask & ALPHA_SIZE_BIT) != 0 && // larger template.alpha_size() > alpha_size()) { return(false); } if ((template.bitmask & ACCUM_RED_SIZE_BIT) != 0 && // larger template.accum_red_size() > accum_red_size()) { return(false); } if ((template.bitmask & ACCUM_GREEN_SIZE_BIT) != 0 && // larger template.accum_green_size() > accum_green_size()) { return(false); } if ((template.bitmask & ACCUM_BLUE_SIZE_BIT) != 0 && // larger template.accum_blue_size() > accum_blue_size()) { return(false); } if ((template.bitmask & ACCUM_ALPHA_SIZE_BIT) != 0 && // larger template.accum_alpha_size() > accum_alpha_size()) { return(false); } if ((template.bitmask & DOUBLE_BUFFER_BIT) != 0 && // exact !double_buffer()) { return(false); } if ((template.bitmask & STERO_BIT) != 0 && // exact !stero()) { return(false); } if ((template.bitmask & BUFFER_SIZE_BIT) != 0 && // larger template.buffer_size() > buffer_size()) { return(false); } if ((template.bitmask & DEPTH_SIZE_BIT) != 0 && // larger template.depth_size() > depth_size()) { return(false); } if ((template.bitmask & STENCIL_SIZE_BIT) != 0 && // larger template.stencil_size() > stencil_size()) { return(false); } if ((template.bitmask & AUX_BUFFERS_BIT) != 0 && // larger template.aux_buffers() > aux_buffers()) { return(false); } if ((template.bitmask & LEVEL_BIT) != 0 && // exact template.level() == level()) { return(false); } return(true); }
public bool match(VisualConfig template) { // TODO if ((template.bitmask & VISUAL_BIT) != 0 // exact && template.visual_id () != visual_id ()) return false; if ((template.bitmask & CLASS_BIT) != 0 // exact && template.clazz () != clazz ()) return false; if ((template.bitmask & RGBA_BIT) != 0 // exact && !rgba ()) return false; if ((template.bitmask & RED_SIZE_BIT) != 0 // larger && template.red_size () > red_size ()) return false; if ((template.bitmask & GREEN_SIZE_BIT) != 0 // larger && template.green_size () > green_size ()) return false; if ((template.bitmask & BLUE_SIZE_BIT) != 0 // larger && template.blue_size () > blue_size ()) return false; if ((template.bitmask & ALPHA_SIZE_BIT) != 0 // larger && template.alpha_size () > alpha_size ()) return false; if ((template.bitmask & ACCUM_RED_SIZE_BIT) != 0 // larger && template.accum_red_size () > accum_red_size ()) return false; if ((template.bitmask & ACCUM_GREEN_SIZE_BIT) != 0 // larger && template.accum_green_size () > accum_green_size ()) return false; if ((template.bitmask & ACCUM_BLUE_SIZE_BIT) != 0 // larger && template.accum_blue_size () > accum_blue_size ()) return false; if ((template.bitmask & ACCUM_ALPHA_SIZE_BIT) != 0 // larger && template.accum_alpha_size () > accum_alpha_size ()) return false; if ((template.bitmask & DOUBLE_BUFFER_BIT) != 0 // exact && !double_buffer ()) return false; if ((template.bitmask & STERO_BIT) != 0 // exact && !stero ()) return false; if ((template.bitmask & BUFFER_SIZE_BIT) != 0 // larger && template.buffer_size () > buffer_size ()) return false; if ((template.bitmask & DEPTH_SIZE_BIT) != 0 // larger && template.depth_size () > depth_size ()) return false; if ((template.bitmask & STENCIL_SIZE_BIT) != 0 // larger && template.stencil_size () > stencil_size ()) return false; if ((template.bitmask & AUX_BUFFERS_BIT) != 0 // larger && template.aux_buffers () > aux_buffers ()) return false; if ((template.bitmask & LEVEL_BIT) != 0 // exact && template.level () == level ()) return false; return true; }