/** Draws the entire contents of the overlay on top of the OpenGL drawable. This is a convenience method which encapsulates all portions of the rendering process; if this method is used, {@link #beginRendering}, {@link #endRendering}, etc. should not be used. This method should be called while the OpenGL context for the drawable is current, and after your OpenGL scene has been rendered. @throws GLException If an OpenGL context is not current when this method is called */ public void drawAll() throws GLException { beginRendering(); draw(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); endRendering(); }
this.overlay = new Overlay(canvas.getDrawable()); Graphics2D g2d = overlay.createGraphics(); renderer.paint(g2d, canvas.getRendererWidth(), canvas.getRendererHeight()); overlay.markDirty(0, 0, canvas.getRendererWidth(), canvas.getRendererHeight()); overlay.drawAll(); g2d.dispose();
/** Draws the specified sub-rectangle of the overlay on top of the OpenGL drawable. {@link #beginRendering} and {@link #endRendering} must be used in conjunction with this method to achieve proper rendering results. This method should be called while the OpenGL context for the drawable is current, and after your OpenGL scene has been rendered. @param x the lower-left x coordinate (relative to the lower left of the overlay) of the rectangle to draw @param y the lower-left y coordinate (relative to the lower left of the overlay) of the rectangle to draw @param width the width of the rectangle to draw @param height the height of the rectangle to draw @throws GLException If an OpenGL context is not current when this method is called */ public void draw(final int x, final int y, final int width, final int height) throws GLException { draw(x, y, x, y, width, height); }
/** Creates a {@link java.awt.Graphics2D Graphics2D} instance for rendering into the overlay. The returned object should be disposed of using the normal {@link java.awt.Graphics#dispose() Graphics.dispose()} method once it is no longer being used. @return a new {@link java.awt.Graphics2D Graphics2D} object for rendering into the backing store of this renderer */ public Graphics2D createGraphics() { // Validate the size of the renderer against the current size of // the drawable validateRenderer(); return renderer.createGraphics(); }