public void bindTexture() { if (buffer == -1) throw new IllegalStateException("Buffer has been disposed"); GlStateManager.bindTexture(texture); } }
public void bind() { counter = 0; GlStateManager.bindTexture(getTextureId()); }
@SuppressWarnings("static-access") protected void initialize() { GlStateManager.enableTexture2D(); texture_id_[0] = glGenTextures(); if(MCEF.CHECK_VRAM_LEAK) GL_TEXTURES.add(texture_id_[0]); GlStateManager.bindTexture(texture_id_[0]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); GlStateManager.bindTexture(0); }
public void load(File file) { THREAD_SERVICE.submit(() -> { try { //Loads the image FileInputStream inputStream = new FileInputStream(file); BufferedImage image = ImageIO.read(inputStream); this.width = image.getWidth(); this.height = image.getHeight(); //Creates the ByteBuffer int[] imageData = new int[this.width * this.height]; image.getRGB(0, 0, this.width, this.height, imageData, 0, this.width); buffer = createBuffer(imageData); Minecraft.getMinecraft().addScheduledTask(() -> { GlStateManager.bindTexture(getTextureId()); GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, buffer); }); } catch(IOException e) { e.printStackTrace(); } }); }
@Override public void update() { if(framesTextureData.size() > 0) { if(++frameCounter >= framesTextureData.size()) { frameCounter = 0; } ByteBuffer buffer = framesTextureData.get(frameCounter); GlStateManager.bindTexture(getTextureId()); GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, buffer); } if(counter++ >= 600) { delete = true; GlStateManager.deleteTexture(getTextureId()); } }
@SideOnly(Side.CLIENT) @Override public void render(final boolean enabled, final float partialTicks) { if (!enabled) { return; } rotateForRendering(); RenderUtil.ignoreLighting(); GlStateManager.bindTexture(getGlTextureId()); RenderUtil.drawQuad(); }
GlStateManager.bindTexture(texture); GlStateManager.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, textureWidth, textureHeight, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, null); GlStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); GlStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); GlStateManager.bindTexture(0);
entityRenderer.renderWorld(event.renderTickTime, renderEndNanoTime + (1000000000 / fps)); GlStateManager.bindTexture(registerMirrors.get(entity)); GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, 0, 0, quality, quality, 0);
public RenderSchematic(final Minecraft minecraft) { super(minecraft); this.mc = minecraft; this.profiler = minecraft.mcProfiler; this.renderManager = minecraft.getRenderManager(); GlStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); GlStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); GlStateManager.bindTexture(0); this.vboEnabled = OpenGlHelper.useVbo(); if (this.vboEnabled) { initVbo(); } else { initList(); } }
public void render(double x1, double y1, double x2, double y2) { if(view_width_ == 0 || view_height_ == 0) return; Tessellator t = Tessellator.getInstance(); BufferBuilder vb = t.getBuffer(); GlStateManager.bindTexture(texture_id_[0]); vb.begin(GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); vb.pos(x1, y1, 0.0).tex(0.0, 1.0).color(255, 255, 255, 255).endVertex(); vb.pos(x2, y1, 0.0).tex(1.f, 1.f).color(255, 255, 255, 255).endVertex(); vb.pos(x2, y2, 0.0).tex(1.f, 0.0).color(255, 255, 255, 255).endVertex(); vb.pos(x1, y2, 0.0).tex(0.0, 0.0).color(255, 255, 255, 255).endVertex(); t.draw(); GlStateManager.bindTexture(0); }
GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GlStateManager.bindTexture(image.textureId);
TextureScaleInfo.yScale = (double) DynamicStitcher.BASE_HEIGHT / newHeight; GlStateManager.bindTexture(getGlTextureId()); for (TextureAtlasSprite loadedSprite : stitcher.getAllSprites()) { TextureUtil.uploadTextureMipmap(loadedSprite.getFrameTextureData(0), loadedSprite.getIconWidth(), loadedSprite.getIconHeight(), loadedSprite.getOriginX(), loadedSprite.getOriginY(), false, false); GlStateManager.bindTexture(getGlTextureId()); for (TextureAtlasSprite sprite : spritesNeedingUpload) { spritesNeedingUpload.remove(sprite);
public static void renderGhostModel( final IBakedModel baked, final World worldObj, final BlockPos blockPos, final boolean isUnplaceable ) { final int alpha = isUnplaceable ? 0x22000000 : 0xaa000000; GlStateManager.bindTexture( Minecraft.getMinecraft().getTextureMapBlocks().getGlTextureId() ); GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f ); GlStateManager.enableBlend(); GlStateManager.enableTexture2D(); GlStateManager.blendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA ); GlStateManager.colorMask( false, false, false, false ); RenderHelper.renderModel( baked, worldObj, blockPos, alpha ); GlStateManager.colorMask( true, true, true, true ); GlStateManager.depthFunc( GL11.GL_LEQUAL ); RenderHelper.renderModel( baked, worldObj, blockPos, alpha ); GlStateManager.disableBlend(); }
GlStateManager.bindTexture(texture_id_[0]); GlStateManager.bindTexture(0);
GlStateManager.bindTexture(newTextureId); GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, quality, quality, 0, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, BufferUtils.createByteBuffer(3 * quality * quality)); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); GlStateManager.bindTexture(registerMirrors.get(entityMirror));
public static void drawOutlinedBoundingBox2(AxisAlignedBB bb, float r, float g, float b, float width) { GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.color(r, g, b, 0.4F); GlStateManager.bindTexture(0); float hw = width / 2; drawCuboid((float) bb.minX, (float) bb.minY - hw, (float) bb.minZ - hw, (float) bb.maxX, (float) bb.minY + hw, (float) bb.minZ + hw); drawCuboid((float) bb.minX, (float) bb.maxY - hw, (float) bb.minZ - hw, (float) bb.maxX, (float) bb.maxY + hw, (float) bb.minZ + hw); drawCuboid((float) bb.minX, (float) bb.minY - hw, (float) bb.maxZ - hw, (float) bb.maxX, (float) bb.minY + hw, (float) bb.maxZ + hw); drawCuboid((float) bb.minX, (float) bb.maxY - hw, (float) bb.maxZ - hw, (float) bb.maxX, (float) bb.maxY + hw, (float) bb.maxZ + hw); drawCuboid((float) bb.minX - hw, (float) bb.minY, (float) bb.minZ - hw, (float) bb.minX + hw, (float) bb.maxY, (float) bb.minZ + hw); drawCuboid((float) bb.maxX - hw, (float) bb.minY, (float) bb.minZ - hw, (float) bb.maxX + hw, (float) bb.maxY, (float) bb.minZ + hw); drawCuboid((float) bb.minX - hw, (float) bb.minY, (float) bb.maxZ - hw, (float) bb.minX + hw, (float) bb.maxY, (float) bb.maxZ + hw); drawCuboid((float) bb.maxX - hw, (float) bb.minY, (float) bb.maxZ - hw, (float) bb.maxX + hw, (float) bb.maxY, (float) bb.maxZ + hw); drawCuboid((float) bb.minX - hw, (float) bb.minY - hw, (float) bb.minZ, (float) bb.minX + hw, (float) bb.minY + hw, (float) bb.maxZ); drawCuboid((float) bb.minX - hw, (float) bb.maxY - hw, (float) bb.minZ, (float) bb.minX + hw, (float) bb.maxY + hw, (float) bb.maxZ); drawCuboid((float) bb.maxX - hw, (float) bb.minY - hw, (float) bb.minZ, (float) bb.maxX + hw, (float) bb.minY + hw, (float) bb.maxZ); drawCuboid((float) bb.maxX - hw, (float) bb.maxY - hw, (float) bb.minZ, (float) bb.maxX + hw, (float) bb.maxY + hw, (float) bb.maxZ); GlStateManager.disableBlend(); }
/** * @reason Replaces the updateAnimations method to only tick animated textures * that are in one of the loaded RenderChunks. This can lead to an FPS more than * three times higher on large modpacks with many textures. * <p> * Also breaks down the "root.tick.textures" profiler by texture name. */ @Overwrite public void updateAnimations() { // TODO: Recalculate list after chunk update instead! Minecraft.getMinecraft().profiler.startSection("determineVisibleTextures"); for (RenderGlobal.ContainerLocalRenderInformation renderInfo : Minecraft.getMinecraft().renderGlobal.renderInfos) { for (TextureAtlasSprite texture : ((IPatchedCompiledChunk) renderInfo.renderChunk.compiledChunk).getVisibleTextures()) { ((IPatchedTextureAtlasSprite) texture).markNeedsAnimationUpdate(); } } Minecraft.getMinecraft().profiler.endSection(); GlStateManager.bindTexture(getGlTextureId()); for (TextureAtlasSprite texture : listAnimatedSprites) { if (((IPatchedTextureAtlasSprite) texture).needsAnimationUpdate()) { Minecraft.getMinecraft().profiler.startSection(texture.getIconName()); texture.updateAnimation(); ((IPatchedTextureAtlasSprite) texture).unmarkNeedsAnimationUpdate(); // Can't do this from updateAnimation mixin, that method can be overriden Minecraft.getMinecraft().profiler.endSection(); } } } }
TextureUtil.uploadTexture(textureId, flippedPixels, resolution, resolution); GlStateManager.bindTexture(textureId); RenderUtil.drawRectWithTexture(-1, 0, 0, 0, 1, 1, resolution, resolution, resolution, resolution); GlStateManager.deleteTexture(textureId);
GlStateManager.bindTexture(0);
GlStateManager.bindTexture(0);