Beispiel #1
0
 private void drawRect(int x, int y, int width, int height, float matrix[]) {
   GL11 gl = mGL;
   gl.glPushMatrix();
   gl.glMultMatrixf(toGLMatrix(matrix), 0);
   putRectangle(x, y, width, height, mXyBuffer, mXyPointer);
   gl.glDrawArrays(GL11.GL_TRIANGLE_STRIP, 0, 4);
   gl.glPopMatrix();
 }
  private void textureRect(float x, float y, float width, float height) {
    GL11 gl = mGL;

    saveTransform();
    translate(x, y);
    scale(width, height, 1);

    gl.glLoadMatrixf(mMatrixValues, 0);
    gl.glDrawArrays(GL11.GL_TRIANGLE_STRIP, OFFSET_FILL_RECT, 4);

    restoreTransform();
    mCountTextureRect++;
  }
  public void fillRect(float x, float y, float width, float height, int color) {
    mGLState.setColorMode(color, mAlpha);
    GL11 gl = mGL;

    saveTransform();
    translate(x, y);
    scale(width, height, 1);

    gl.glLoadMatrixf(mMatrixValues, 0);
    gl.glDrawArrays(GL11.GL_TRIANGLE_STRIP, OFFSET_FILL_RECT, 4);

    restoreTransform();
    mCountFillRect++;
  }
  public void drawLine(float x1, float y1, float x2, float y2, GLPaint paint) {
    GL11 gl = mGL;

    mGLState.setColorMode(paint.getColor(), mAlpha);
    mGLState.setLineWidth(paint.getLineWidth());

    saveTransform();
    translate(x1, y1);
    scale(x2 - x1, y2 - y1, 1);

    gl.glLoadMatrixf(mMatrixValues, 0);
    gl.glDrawArrays(GL11.GL_LINE_STRIP, OFFSET_DRAW_LINE, 2);

    restoreTransform();
    mCountDrawLine++;
  }
  public void drawRect(float x, float y, float width, float height, GLPaint paint) {
    GL11 gl = mGL;

    mGLState.setColorMode(paint.getColor(), mAlpha);
    mGLState.setLineWidth(paint.getLineWidth());

    saveTransform();
    translate(x, y);
    scale(width, height, 1);

    gl.glLoadMatrixf(mMatrixValues, 0);
    gl.glDrawArrays(GL11.GL_LINE_LOOP, OFFSET_DRAW_RECT, 4);

    restoreTransform();
    mCountDrawLine++;
  }