@Override public Surface fillRect(float x, float y, float width, float height) { bindFramebuffer(); GLShader shader = ctx.quadShader(this.shader); if (fillPattern != null) { int tex = fillPattern.ensureTexture(); if (tex > 0) { shader.prepareTexture(tex, tint); float tw = fillPattern.width(), th = fillPattern.height(), r = x+width, b = y+height; shader.addQuad(topTransform(), x, y, x+width, y+height, x / tw, y / th, r / tw, b / th); } } else { int tex = ctx.fillImage().ensureTexture(); shader.prepareTexture(tex, Tint.combine(fillColor, tint)); shader.addQuad(topTransform(), x, y, x+width, y+height, 0, 0, 1, 1); } return this; }
@Override public Surface fillTriangles(float[] xys, int xysOffset, int xysLen, int[] indices, int indicesOffset, int indicesLen, int indexBase) { bindFramebuffer(); GLShader shader = ctx.trisShader(this.shader); if (fillPattern != null) { int tex = fillPattern.ensureTexture(); if (tex > 0) { shader.prepareTexture(tex, tint); shader.addTriangles(topTransform(), xys, xysOffset, xysLen, fillPattern.width(), fillPattern.height(), indices, indicesOffset, indicesLen, indexBase); } } else { int tex = ctx.fillImage().ensureTexture(); shader.prepareTexture(tex, Tint.combine(fillColor, tint)); shader.addTriangles(topTransform(), xys, xysOffset, xysLen, 1, 1, indices, indicesOffset, indicesLen, indexBase); } return this; }
int tex = ctx.fillImage().ensureTexture(); shader.prepareTexture(tex, Tint.combine(fillColor, tint)); shader.addQuad(l, 0, 0, length, width, 0, 0, 1, 1);