@Override protected void paint () { makeCurrent(); super.paint(); canvas.swapBuffers(); }
@Override protected void paint () { makeCurrent(); super.paint(); canvas.swapBuffers(); }
public void handleEvent(Event event) { // resize our GLCanvas to fill the window; we do manual layout so that other SWT widgets // can be overlaid on top of our GLCanvas Rectangle bounds = comp.getBounds(); comp.setBounds(bounds); canvas.setBounds(bounds); makeCurrent(); // SWTGraphics.this.platform.log().info("Resized " + bounds.width + "x" + bounds.height); ctx.setSize(ctx.scale.invScaledFloor(bounds.width), ctx.scale.invScaledFloor(bounds.height)); } });
public void handleEvent(Event event) { // resize our GLCanvas to fill the window; we do manual layout so that other SWT widgets // can be overlaid on top of our GLCanvas Rectangle bounds = comp.getBounds(); comp.setBounds(bounds); canvas.setBounds(bounds); makeCurrent(); // SWTGraphics.this.platform.log().info("Resized " + bounds.width + "x" + bounds.height); ctx.setSize(ctx.scale.invScaledFloor(bounds.width), ctx.scale.invScaledFloor(bounds.height)); } });
public SWTGraphics (SWTPlatform platform, JavaPlatform.Config config, final Composite comp) { super(platform, config); this.platform = platform; // create our GLCanvas GLData data = new GLData (); data.doubleBuffer = true; canvas = new GLCanvas(comp, SWT.NONE, data); makeCurrent(); comp.addListener(SWT.Resize, new Listener() { public void handleEvent(Event event) { // resize our GLCanvas to fill the window; we do manual layout so that other SWT widgets // can be overlaid on top of our GLCanvas Rectangle bounds = comp.getBounds(); comp.setBounds(bounds); canvas.setBounds(bounds); makeCurrent(); // SWTGraphics.this.platform.log().info("Resized " + bounds.width + "x" + bounds.height); ctx.setSize(ctx.scale.invScaledFloor(bounds.width), ctx.scale.invScaledFloor(bounds.height)); } }); // platform.log().info("Setting size " + config.width + "x" + config.height); platform.comp.setSize(ctx.scale.scaledCeil(config.width), ctx.scale.scaledCeil(config.height)); platform.shell.pack(); }
public SWTGraphics (SWTPlatform platform, JavaPlatform.Config config, final Composite comp) { super(platform, config); this.platform = platform; // create our GLCanvas GLData data = new GLData (); data.doubleBuffer = true; canvas = new GLCanvas(comp, SWT.NONE, data); makeCurrent(); comp.addListener(SWT.Resize, new Listener() { public void handleEvent(Event event) { // resize our GLCanvas to fill the window; we do manual layout so that other SWT widgets // can be overlaid on top of our GLCanvas Rectangle bounds = comp.getBounds(); comp.setBounds(bounds); canvas.setBounds(bounds); makeCurrent(); // SWTGraphics.this.platform.log().info("Resized " + bounds.width + "x" + bounds.height); ctx.setSize(ctx.scale.invScaledFloor(bounds.width), ctx.scale.invScaledFloor(bounds.height)); } }); // platform.log().info("Setting size " + config.width + "x" + config.height); platform.comp.setSize(ctx.scale.scaledCeil(config.width), ctx.scale.scaledCeil(config.height)); platform.shell.pack(); }