/** * Ensures that the texture is bound to the given unit * and that the unit is currently active (for modification). * * @param target The texture target, one of GL_TEXTURE_*** * @param img The image texture to bind * @param unit At what unit to bind the texture. */ private void bindTextureAndUnit(int target, Image img, int unit) { if (context.boundTextureUnit != unit) { gl.glActiveTexture(GL.GL_TEXTURE0 + unit); context.boundTextureUnit = unit; } if (context.boundTextures[unit] != img) { gl.glBindTexture(target, img.getId()); context.boundTextures[unit] = img; statistics.onTextureUse(img, true); } else { statistics.onTextureUse(img, false); } }
/** * Ensures that the texture is bound to the given unit, * but does not care if the unit is active (for rendering). * * @param target The texture target, one of GL_TEXTURE_*** * @param img The image texture to bind * @param unit At what unit to bind the texture. */ private void bindTextureOnly(int target, Image img, int unit) { if (context.boundTextures[unit] != img) { if (context.boundTextureUnit != unit) { gl.glActiveTexture(GL.GL_TEXTURE0 + unit); context.boundTextureUnit = unit; } gl.glBindTexture(target, img.getId()); context.boundTextures[unit] = img; statistics.onTextureUse(img, true); } else { statistics.onTextureUse(img, false); } }
/** * Ensures that the texture is bound to the given unit * and that the unit is currently active (for modification). * * @param target The texture target, one of GL_TEXTURE_*** * @param img The image texture to bind * @param unit At what unit to bind the texture. */ private void bindTextureAndUnit(int target, Image img, int unit) { if (context.boundTextureUnit != unit) { gl.glActiveTexture(GL.GL_TEXTURE0 + unit); context.boundTextureUnit = unit; } if (context.boundTextures[unit] != img) { gl.glBindTexture(target, img.getId()); context.boundTextures[unit] = img; statistics.onTextureUse(img, true); } else { statistics.onTextureUse(img, false); } }
/** * Ensures that the texture is bound to the given unit, * but does not care if the unit is active (for rendering). * * @param target The texture target, one of GL_TEXTURE_*** * @param img The image texture to bind * @param unit At what unit to bind the texture. */ private void bindTextureOnly(int target, Image img, int unit) { if (context.boundTextures[unit] != img) { if (context.boundTextureUnit != unit) { gl.glActiveTexture(GL.GL_TEXTURE0 + unit); context.boundTextureUnit = unit; } gl.glBindTexture(target, img.getId()); context.boundTextures[unit] = img; statistics.onTextureUse(img, true); } else { statistics.onTextureUse(img, false); } }
textures[unit] = image; statistics.onTextureUse(image, true); } else { statistics.onTextureUse(image, false);
context.boundTextures[unit] = img; statistics.onTextureUse(img, true);