/** Ends a series of drawing commands that were clipped per a call to {@link #startClipped}. */ public void endClipped () { batch.flush(); // flush our clipped calls with SCISSOR_TEST still enabled Rectangle r = popScissorState(); if (r == null) batch.gl.glDisable(GL20.GL_SCISSOR_TEST); else batch.gl.glScissor(r.x, r.y, r.width, r.height); batch.gl.checkError("endClipped"); }
/** Ends a series of drawing commands that were clipped per a call to {@link #startClipped}. */ public void endClipped () { batch.flush(); // flush our clipped calls with SCISSOR_TEST still enabled Rectangle r = popScissorState(); if (r == null) batch.gl.glDisable(GL20.GL_SCISSOR_TEST); else batch.gl.glScissor(r.x, r.y, r.width, r.height); batch.gl.checkError("endClipped"); }
@Override public void flush () { super.flush(); if (quadCounter > 0) { bindTexture(); gl.glUniform4fv(uData, quadCounter * vec4sPerQuad(), data, 0); gl.glDrawElements(GL_TRIANGLES, quadCounter*ELEMENTS_PER_QUAD, GL_UNSIGNED_SHORT, 0); gl.checkError("UniformQuadBatch flush"); quadCounter = 0; } }
@Override public void flush () { super.flush(); if (quadCounter > 0) { bindTexture(); gl.glUniform4fv(uData, quadCounter * vec4sPerQuad(), data, 0); gl.glDrawElements(GL_TRIANGLES, quadCounter*ELEMENTS_PER_QUAD, GL_UNSIGNED_SHORT, 0); gl.checkError("UniformQuadBatch flush"); quadCounter = 0; } }
/** 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(); }
@Override public void flush () { super.flush(); if (vertPos > 0) { bindTexture(); if (delayedBinding) { bindAttribsBufs(); // see comments in activate() gl.checkError("TriangleBatch.flush bind"); } gl.bufs.setFloatBuffer(vertices, 0, vertPos); gl.glBufferData(GL_ARRAY_BUFFER, vertPos*4, gl.bufs.floatBuffer, GL_STREAM_DRAW); gl.bufs.setShortBuffer(elements, 0, elemPos); gl.glBufferData(GL_ELEMENT_ARRAY_BUFFER, elemPos*2, gl.bufs.shortBuffer, GL_STREAM_DRAW); gl.checkError("TriangleBatch.flush BufferData"); gl.glDrawElements(GL_TRIANGLES, elemPos, GL_UNSIGNED_SHORT, 0); gl.checkError("TriangleBatch.flush DrawElements"); vertPos = 0; elemPos = 0; } }
@Override public void flush () { super.flush(); if (vertPos > 0) { bindTexture(); if (delayedBinding) { bindAttribsBufs(); // see comments in activate() gl.checkError("TriangleBatch.flush bind"); } gl.bufs.setFloatBuffer(vertices, 0, vertPos); gl.glBufferData(GL_ARRAY_BUFFER, vertPos*4, gl.bufs.floatBuffer, GL_STREAM_DRAW); gl.bufs.setShortBuffer(elements, 0, elemPos); gl.glBufferData(GL_ELEMENT_ARRAY_BUFFER, elemPos*2, gl.bufs.shortBuffer, GL_STREAM_DRAW); gl.checkError("TriangleBatch.flush BufferData"); gl.glDrawElements(GL_TRIANGLES, elemPos, GL_UNSIGNED_SHORT, 0); gl.checkError("TriangleBatch.flush DrawElements"); vertPos = 0; elemPos = 0; } }