/** Starts a series of drawing commands that are clipped to the specified rectangle (in view * coordinates, not OpenGL coordinates). Thus must be followed by a call to {@link #endClipped} * when the clipped drawing commands are done. * * @return whether the resulting clip rectangle is non-empty. <em>Note:</em> the caller may wish * to skip their drawing if this returns false, but they must still call {@link #endClipped}. */ public boolean startClipped (int x, int y, int width, int height) { batch.flush(); // flush any pending unclipped calls Rectangle r = pushScissorState(x, target.flip() ? target.height()-y-height : y, width, height); batch.gl.glScissor(r.x, r.y, r.width, r.height); if (scissorDepth == 1) batch.gl.glEnable(GL20.GL_SCISSOR_TEST); batch.gl.checkError("startClipped"); return !r.isEmpty(); }
/** Starts a series of drawing commands that are clipped to the specified rectangle (in view * coordinates, not OpenGL coordinates). Thus must be followed by a call to {@link #endClipped} * when the clipped drawing commands are done. * * @return whether the resulting clip rectangle is non-empty. <em>Note:</em> the caller may wish * to skip their drawing if this returns false, but they must still call {@link #endClipped}. */ public boolean startClipped (int x, int y, int width, int height) { batch.flush(); // flush any pending unclipped calls Rectangle r = pushScissorState(x, target.flip() ? target.height()-y-height : y, width, height); batch.gl.glScissor(r.x, r.y, r.width, r.height); if (scissorDepth == 1) batch.gl.glEnable(GL20.GL_SCISSOR_TEST); batch.gl.checkError("startClipped"); return !r.isEmpty(); }
public SceneGame (Platform plat, int updateRate) { super(plat, updateRate); GL20 gl = plat.graphics().gl; gl.glDisable(GL20.GL_CULL_FACE); gl.glEnable(GL20.GL_BLEND); gl.glBlendFunc(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA); defaultBatch = createDefaultBatch(gl); viewSurf = new Surface(plat.graphics(), plat.graphics().defaultRenderTarget, defaultBatch); rootLayer = new RootLayer(); paint.connect(new Slot<Clock>() { public void onEmit (Clock clock) { paintScene(); } }).atPrio(scenePaintPrio()); }