protected GLShader createQuadShader() { if (shouldTryQuadShader()) { try { GLShader quadShader = new QuadShader(this); quadShader.createCore(); // force core creation to test whether it fails return quadShader; } catch (Throwable t) { platform.reportError("Failed to create QuadShader", t); } } return new IndexedTrisShader(this); }
/** Prepares this shader to render the specified texture, etc. */ public GLShader prepareTexture(int tex, int tint) { // if our GL context has been lost and regained we may need to recreate our core; we don't // destroy the old core because the underlying resources are gone and destroying using our // stale handles might result in destroying someone else's newly created resources if (texEpoch != ctx.epoch()) { texCore = null; } // create our core lazily so that we ensure we're on the GL thread when it happens if (texCore == null) { createCore(); } boolean justActivated = ctx.useShader(this); if (justActivated) { texCore.activate(ctx.curFbufWidth, ctx.curFbufHeight); if (GLContext.STATS_ENABLED) ctx.stats.shaderBinds++; } texCore.prepare(tex, tint, justActivated); return this; }