/** * Forces the creation of our shader core. Used during GLContext.init to determine whether we * need to fall back to a less sophisticated quad shader. */ void createCore() { this.texEpoch = ctx.epoch(); this.texCore = createTextureCore(); }
/** 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; }