protected LayerGL(GLContext ctx) { super(ctx.createTransform()); this.ctx = ctx; this.savedLocal = ctx.createTransform(); }
protected AbstractSurfaceGL(GLContext ctx) { this.ctx = ctx; transformStack.add(ctx.createTransform()); }
@Override public Surface save() { transformStack.add(ctx.createTransform().set(topTransform())); return this; }
protected static int convertToRepTex(GLContext ctx, int tex, int width, int height, boolean repeatX, boolean repeatY, boolean mipmapped) { int reptex = ctx.createTexture(width, height, repeatX, repeatY, mipmapped); int fbuf = ctx.createFramebuffer(reptex); ctx.pushFramebuffer(fbuf, width, height); try { // render the non-repeated texture into the framebuffer properly scaled ctx.clear(0, 0, 0, 0); GLShader shader = ctx.quadShader(null).prepareTexture(tex, Tint.NOOP_TINT); shader.addQuad(ctx.createTransform(), 0, height, width, 0, 0, 0, 1, 1); shader.flush(); // if we're mipmapped, we can now generate our mipmaps if (mipmapped) ctx.generateMipmap(reptex); return reptex; } finally { // we no longer need this framebuffer; rebind the previous framebuffer and delete ours ctx.popFramebuffer(); ctx.deleteFramebuffer(fbuf); } } }
float wy = dy * (width / 2) / length; InternalTransform l = ctx.createTransform(); l.setRotation(FloatMath.atan2(dy, dx)); l.setTranslation(x0 + wy, y0 - wx);
float sl = this.x, st = this.y, sr = sl + this.width, sb = st + this.height; GLShader shader = ctx.quadShader(null).prepareTexture(tex, Tint.NOOP_TINT); shader.addQuad(ctx.createTransform(), 0, height, width, 0, sl / tw, st / th, sr / tw, sb / th); shader.flush();