Exemple #1
0
  /**
   * Sets up the SpriteBatch for drawing. This will disable depth buffer writting. It enables
   * blending and texturing. If you have more texture units enabled than the first one you have to
   * disable them before calling this. Uses a screen coordinate system by default where everything
   * is given in pixels. You can specify your own projection and modelview matrices via {@link
   * #setProjectionMatrix(Matrix4)} and {@link #setTransformMatrix(Matrix4)}.
   */
  public void begin() {
    if (drawing) throw new IllegalStateException("you have to call SpriteBatch.end() first");
    renderCalls = 0;

    Gdx.gl.glDepthMask(false);
    if (Gdx.graphics.isGL20Available()) {
      if (customShader != null) customShader.begin();
      else shader.begin();
    } else {
      Gdx.gl.glEnable(GL10.GL_TEXTURE_2D);
    }
    setupMatrices();

    idx = 0;
    lastTexture = null;
    drawing = true;
  }
Exemple #2
0
 /**
  * Sets the transform matrix to be used by this SpriteBatch. If this is called inside a {@link
  * #begin()}/{@link #end()} block. the current batch is flushed to the gpu.
  *
  * @param transform the transform matrix
  */
 public void setTransformMatrix(Matrix4 transform) {
   if (drawing) flush();
   transformMatrix.set(transform);
   if (drawing) setupMatrices();
 }
Exemple #3
0
 /**
  * Sets the projection matrix to be used by this SpriteBatch. If this is called inside a {@link
  * #begin()}/{@link #end()} block. the current batch is flushed to the gpu.
  *
  * @param projection the projection matrix
  */
 public void setProjectionMatrix(Matrix4 projection) {
   if (drawing) flush();
   projectionMatrix.set(projection);
   if (drawing) setupMatrices();
 }