private void drawChar(final float x, final char ch, final VertexBuffer buffer) { if (Character.isWhitespace(ch) || Character.isISOControl(ch)) { return; } final int index = getCharIndex(ch); final int column = index % COLUMNS; final int row = index / COLUMNS; final float u = column * U_STEP; final float v = row * V_STEP; buffer.pos(x, getCharHeight(), 0).tex(u, v + V_SIZE).endVertex(); buffer.pos(x + getCharWidth(), getCharHeight(), 0).tex(u + U_SIZE, v + V_SIZE).endVertex(); buffer.pos(x + getCharWidth(), 0, 0).tex(u + U_SIZE, v).endVertex(); buffer.pos(x, 0, 0).tex(u, v).endVertex(); }
/** * Draws a textured rectangle at the stored z-value. Args: x, y, u, v, width, height */ public void drawTexturedModalRect(Tessellator tessellator, int x, int y, int width, int height, int zLevel) { tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); tessellator.getBuffer().pos((double) (x), (double) (y + height), (double) zLevel).tex(0F, 1F).endVertex(); tessellator.getBuffer().pos((double) (x + width), (double) (y + height), (double) zLevel).tex(1F, 1F).endVertex(); tessellator.getBuffer().pos((double) (x + width), (double) (y), (double) zLevel).tex(1F, 0F).endVertex(); tessellator.getBuffer().pos((double) (x), (double) (y), (double) zLevel).tex(0F, 0F).endVertex(); tessellator.draw(); }
public void drawTexturedModalRect(int x, int y, int width, int height, int tex_x, int tex_y, int tex_width, int tex_height) { Tessellator tessellator = Tessellator.getInstance(); tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); tessellator.getBuffer().pos((double) (x + 0), (double) (y + height), (double) this.zLevel).tex((double) ((float) (tex_x + 0)), (double) ((float) (tex_y + tex_height))).endVertex(); tessellator.getBuffer().pos((double) (x + width), (double) (y + height), (double) this.zLevel).tex((double) ((float) (tex_x + tex_width)), (double) ((float) (tex_y + tex_height))).endVertex(); tessellator.getBuffer().pos((double) (x + width), (double) (y + 0), (double) this.zLevel).tex((double) ((float) (tex_x + tex_width)), (double) ((float) (tex_y + 0))).endVertex(); tessellator.getBuffer().pos((double) (x + 0), (double) (y + 0), (double) this.zLevel).tex((double) ((float) (tex_x + 0)), (double) ((float) (tex_y + 0))).endVertex(); tessellator.draw(); }
public void drawTexturedModalRect(int x, int y, int width, int height, int tex_x, int tex_y, int tex_width, int tex_height) { Tessellator tessellator = Tessellator.getInstance(); tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); tessellator.getBuffer().pos((double) (x + 0), (double) (y + height), (double) this.zLevel).tex((double) ((float) (tex_x + 0)), (double) ((float) (tex_y + tex_height))).endVertex(); tessellator.getBuffer().pos((double) (x + width), (double) (y + height), (double) this.zLevel).tex((double) ((float) (tex_x + tex_width)), (double) ((float) (tex_y + tex_height))).endVertex(); tessellator.getBuffer().pos((double) (x + width), (double) (y + 0), (double) this.zLevel).tex((double) ((float) (tex_x + tex_width)), (double) ((float) (tex_y + 0))).endVertex(); tessellator.getBuffer().pos((double) (x + 0), (double) (y + 0), (double) this.zLevel).tex((double) ((float) (tex_x + 0)), (double) ((float) (tex_y + 0))).endVertex(); tessellator.draw(); } }
public static void renderTexturedQuad(float par1, float par2, float par3, float par4) { Tessellator par0Tessellator = Tessellator.getInstance(); VertexBuffer renderer = par0Tessellator.getBuffer(); renderer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM); renderer.pos(0, 0, 0).tex((double) par1, (double) par4).normal(0, 0, 1).endVertex(); renderer.pos(1, 0, 0).tex((double) par3, (double) par4).normal(0, 0, 1).endVertex(); renderer.pos(1, 1, 0).tex((double) par3, (double) par2).normal(0, 0, 1).endVertex(); renderer.pos(0, 1, 0).tex((double) par1, (double) par2).normal(0, 0, 1).endVertex(); par0Tessellator.draw(); }
public void drawTexturedModalRect(int x, int y, int width, int height, int tex_x, int tex_y, int tex_width, int tex_height) { Tessellator tessellator = Tessellator.getInstance(); tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); tessellator.getBuffer().pos((double) (x), (double) (y + height), (double) this.zLevel).tex((double) ((float) (tex_x)), (double) ((float) (tex_y + tex_height))).endVertex(); tessellator.getBuffer().pos((double) (x + width), (double) (y + height), (double) this.zLevel).tex((double) ((float) (tex_x + tex_width)), (double) ((float) (tex_y + tex_height))).endVertex(); tessellator.getBuffer().pos((double) (x + width), (double) (y), (double) this.zLevel).tex((double) ((float) (tex_x + tex_width)), (double) ((float) (tex_y))).endVertex(); tessellator.getBuffer().pos((double) (x), (double) (y), (double) this.zLevel).tex((double) ((float) (tex_x)), (double) ((float) (tex_y))).endVertex(); tessellator.draw(); }
public static void renderTexturedQuad(int x, int y, float z, int width, int height) { Tessellator tessellator = Tessellator.getInstance(); tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); tessellator.getBuffer().pos((double) (x), (double) (y + height), (double) z).tex(0D, 1D).endVertex(); tessellator.getBuffer().pos((double) (x + width), (double) (y + height), (double) z).tex(1D, 1D).endVertex(); tessellator.getBuffer().pos((double) (x + width), (double) (y), (double) z).tex(1D, 0D).endVertex(); tessellator.getBuffer().pos((double) (x), (double) (y), (double) z).tex(0D, 0D).endVertex(); tessellator.draw(); } }
private void setupRender(int xBase, int yBase, int uBase, int vBase) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); minecraft.getTextureManager().bindTexture(Gui.statIcons); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer wr = tessellator.getBuffer(); wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); wr.pos((double) (xBase), (double) (yBase + 18), zLevel).tex((double) ((float) (uBase) * 0.0078125F), (double) ((float) (vBase + 18) * 0.0078125F)).endVertex(); wr.pos((double) (xBase + 18), (double) (yBase + 18), zLevel).tex((double) ((float) (uBase + 18) * 0.0078125F), (double) ((float) (vBase + 18) * 0.0078125F)).endVertex(); wr.pos((double) (xBase + 18), (double) (yBase), zLevel).tex((double) ((float) (uBase + 18) * 0.0078125F), (double) ((float) (vBase) * 0.0078125F)).endVertex(); wr.pos((double) (xBase), (double) (yBase), zLevel).tex((double) ((float) (uBase) * 0.0078125F), (double) ((float) (vBase) * 0.0078125F)).endVertex(); wr.finishDrawing(); } }
@Override @SideOnly(Side.CLIENT) public void render() { Minecraft.getMinecraft().getTextureManager().bindTexture(location); final Tessellator t = Tessellator.getInstance(); final VertexBuffer b = t.getBuffer(); b.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); b.pos(0, 16, 0).tex(0, 1).endVertex(); b.pos(16, 16, 0).tex(1, 1).endVertex(); b.pos(16, 0, 0).tex(1, 0).endVertex(); b.pos(0, 0, 0).tex(0, 0).endVertex(); t.draw(); } }
/** * Draws a textured rectangle at the stored z-value. Args: x, y, u, v, width, height */ public void drawTexturedModalRect(int x, int y, int width, int height, int tex_x, int tex_y, int tex_width, int tex_height) { Tessellator tessellator = Tessellator.getInstance(); tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); tessellator.getBuffer().pos((double) (x), (double) (y + height), (double) this.zLevel).tex((double) ((float) (tex_x)), (double) ((float) (tex_y + tex_height))).endVertex(); tessellator.getBuffer().pos((double) (x + width), (double) (y + height), (double) this.zLevel).tex((double) ((float) (tex_x + tex_width)), (double) ((float) (tex_y + tex_height))).endVertex(); tessellator.getBuffer().pos((double) (x + width), (double) (y), (double) this.zLevel).tex((double) ((float) (tex_x + tex_width)), (double) ((float) (tex_y))).endVertex(); tessellator.getBuffer().pos((double) (x), (double) (y), (double) this.zLevel).tex((double) ((float) (tex_x)), (double) ((float) (tex_y))).endVertex(); tessellator.draw(); }
/** * Draw an arbitrarily sized quad with the specified texture coordinates. * * @param x the x position of the quad. * @param y the y position of the quad. * @param w the width of the quad. * @param h the height of the quad. * @param u0 lower u texture coordinate. * @param v0 lower v texture coordinate. * @param u1 upper u texture coordinate. * @param v1 upper v texture coordinate. */ @SideOnly(Side.CLIENT) public static void drawQuad(final float x, final float y, final float w, final float h, final float u0, final float v0, final float u1, final float v1) { final Tessellator tessellator = Tessellator.getInstance(); final VertexBuffer buffer = tessellator.getBuffer(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); buffer.pos(x, y + h, 0).tex(u0, v1).endVertex(); buffer.pos(x + w, y + h, 0).tex(u1, v1).endVertex(); buffer.pos(x + w, y, 0).tex(u1, v0).endVertex(); buffer.pos(x, y, 0).tex(u0, v0).endVertex(); tessellator.draw(); }
@Override public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) { if (visible) { mc.getTextureManager().bindTexture(image); GlStateManager.color(1, 1, 1, 1); hovered = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height; final int x0 = xPosition; final int x1 = xPosition + width; final int y0 = yPosition + verticalImageOffset; final int y1 = yPosition + verticalImageOffset + ((imageHeightOverride > 0) ? imageHeightOverride : height); final double u0 = 0; final double u1 = u0 + 1; final double v0 = (hoverOverride || getHoverState(hovered) == 2) ? 0.5 : 0; final double v1 = v0 + 0.5; final Tessellator t = Tessellator.getInstance(); final VertexBuffer b = t.getBuffer(); b.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); b.pos(x0, y1, zLevel).tex(u0, v1).endVertex(); b.pos(x1, y1, zLevel).tex(u1, v1).endVertex(); b.pos(x1, y0, zLevel).tex(u1, v0).endVertex(); b.pos(x0, y0, zLevel).tex(u0, v0).endVertex(); t.draw(); } } }
VertexBuffer renderer = tess.getBuffer(); renderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); renderer.pos(offset, top + iconHeight, 0).tex(0, 1).endVertex(); renderer.pos(offset + iconWidth, top + iconHeight, 0).tex(1, 1).endVertex(); renderer.pos(offset + iconWidth, top, 0).tex(1, 0).endVertex(); renderer.pos(offset, top, 0).tex(0, 0).endVertex(); tess.draw();
tess.getBuffer().pos(7F / 16F - flagIndex, 0, 8F / 16F).tex(0, 0.999).endVertex(); tess.getBuffer().pos(7F / 16F - flagIndex - 1, 0, 8F / 16F).tex(1.0025, 0.999).endVertex(); tess.getBuffer().pos(7F / 16F - flagIndex - 1, 1, 8F / 16F).tex(1.0025, 0.001).endVertex(); tess.getBuffer().pos(7F / 16F - flagIndex, 1, 8F / 16F).tex(0, 0.001).endVertex(); tess.getBuffer().pos(7F / 16F - flagIndex, 1, 8F / 16F).tex(0, 0.001).endVertex(); tess.getBuffer().pos(7F / 16F - flagIndex - 1, 1, 8F / 16F).tex(1.0025, 0.001).endVertex(); tess.getBuffer().pos(7F / 16F - flagIndex - 1, 0, 8F / 16F).tex(1.0025, 0.999).endVertex(); tess.getBuffer().pos(7F / 16F - flagIndex, 0, 8F / 16F).tex(0, 0.999).endVertex(); double z2 = getZLevel((float)(i+1) / (float)flag_sections + flagIndex, 3, time); tess.getBuffer().pos(7F / 16F - (float) (i) / (float) flag_sections - flagIndex, 0, 8F / 16F + z1).tex((float) (i) / (float) flag_sections, 0.999).endVertex(); tess.getBuffer().pos(7F / 16F - (float) (i + 1) / (float) flag_sections - flagIndex, 0, 8F / 16F + z2).tex((float) (i + 1) / (float) flag_sections, 0.999).endVertex(); tess.getBuffer().pos(7F / 16F - (float) (i + 1) / (float) flag_sections - flagIndex, 1.0025, 8F / 16F + z2).tex((float) (i + 1) / (float) flag_sections, 0.001).endVertex(); tess.getBuffer().pos(7F / 16F - (float) (i) / (float) flag_sections - flagIndex, 1.0025, 8F / 16F + z1).tex((float) (i) / (float) flag_sections, 0.001).endVertex(); tess.getBuffer().pos(7F / 16F - (float) (i) / (float) flag_sections - flagIndex, 1.0025, 8F / 16F + z1).tex((float) (i) / (float) flag_sections, 0.001).endVertex(); tess.getBuffer().pos(7F / 16F - (float) (i + 1) / (float) flag_sections - flagIndex, 1.0025, 8F / 16F + z2).tex((float) (i + 1) / (float) flag_sections, 0.001).endVertex(); tess.getBuffer().pos(7F / 16F - (float) (i + 1) / (float) flag_sections - flagIndex, 0, 8F / 16F + z2).tex((float) (i + 1) / (float) flag_sections, 0.999).endVertex(); tess.getBuffer().pos(7F / 16F - (float) (i) / (float) flag_sections - flagIndex, 0, 8F / 16F + z1).tex((float) (i) / (float) flag_sections, 0.999).endVertex();
protected void drawTexturedRectangle(double x, double y, double width, double height, int color) { GlStateManager.enableTexture2D(); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); float a = (float) (color >> 24 & 0xFF) / 255.0F; float r = (float) (color >> 16 & 0xFF) / 255.0F; float g = (float) (color >> 8 & 0xFF) / 255.0F; float b = (float) (color & 0xFF) / 255.0F; Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexBuffer = tessellator.getBuffer(); vertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); vertexBuffer.pos(x, y + height, 0.0).tex(0.0F, 1.0F).color(r, g, b, a).endVertex(); vertexBuffer.pos(x + width, y + height, 0.0).tex(1.0F, 1.0F).color(r, g, b, a).endVertex(); vertexBuffer.pos(x + width, y, 0.0).tex(1.0F, 0.0F).color(r, g, b, a).endVertex(); vertexBuffer.pos(x, y, 0.0).tex(0.0F, 0.0F).color(r, g, b, a).endVertex(); tessellator.draw(); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.disableTexture2D(); }
tess.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); tess.getBuffer().pos(8F / 16F, -flagIndex + 1 - 2F / 16F, 0).tex(0, 0.001).endVertex(); tess.getBuffer().pos(8F / 16F, -flagIndex - 2F / 16F, 0).tex(1, 0.001).endVertex(); tess.getBuffer().pos(8F / 16F, -flagIndex - 2F / 16F, 1).tex(1, 0.999).endVertex(); tess.getBuffer().pos(8F / 16F, -flagIndex + 1 - 2F / 16F, 1).tex(0, 0.999).endVertex(); tess.getBuffer().pos(8F / 16F, -flagIndex + 1 - 2F / 16F, 1).tex(0, 0.999).endVertex(); tess.getBuffer().pos(8F / 16F, -flagIndex - 2F / 16F, 1).tex(1, 0.999).endVertex(); tess.getBuffer().pos(8F / 16F, -flagIndex - 2F / 16F, 0).tex(1, 0.001).endVertex(); tess.getBuffer().pos(8F / 16F, -flagIndex + 1 - 2F / 16F, 0).tex(0, 0.001).endVertex(); double z2 = getZLevel((float)(flag_sections - i+1) / (float)flag_sections + flagIndex, 5, time) / 5F; tess.getBuffer().pos(8F / 16F + z1, -flagIndex + (float) (i + 1) / (float) flag_sections - 2F / 16F, 0).tex((float) (i + 1) / (float) flag_sections, 0.999).endVertex(); tess.getBuffer().pos(8F / 16F + z2, -flagIndex + (float) (i) / (float) flag_sections - 2F / 16F, 0).tex((float) (i) / (float) flag_sections, 0.999).endVertex(); tess.getBuffer().pos(8F / 16F + z2, -flagIndex + (float) (i) / (float) flag_sections - 2F / 16F, 1).tex((float) (i) / (float) flag_sections, 0.001).endVertex(); tess.getBuffer().pos(8F / 16F + z1, -flagIndex + (float) (i + 1) / (float) flag_sections - 2F / 16F, 1).tex((float) (i + 1) / (float) flag_sections, 0.001).endVertex(); tess.getBuffer().pos(8F / 16F + z1, -flagIndex + (float) (i + 1) / (float) flag_sections - 2F / 16F, 1).tex((float) (i + 1) / (float) flag_sections, 0.001).endVertex(); tess.getBuffer().pos(8F / 16F + z2, -flagIndex + (float) (i) / (float) flag_sections - 2F / 16F, 1).tex((float) (i) / (float) flag_sections, 0.001).endVertex(); tess.getBuffer().pos(8F / 16F + z2, -flagIndex + (float) (i) / (float) flag_sections - 2F / 16F, 0).tex((float) (i) / (float) flag_sections, 0.999).endVertex(); tess.getBuffer().pos(8F / 16F + z1, -flagIndex + (float) (i + 1) / (float) flag_sections - 2F / 16F, 0).tex((float) (i + 1) / (float) flag_sections, 0.999).endVertex();
GL11.glNormal3f(0, 0, f10); tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); tessellator.getBuffer().pos(0, -2, 0).tex(f2, 0).endVertex(); tessellator.getBuffer().pos(16 * depth, -2, 0).tex(0, 0).endVertex(); tessellator.getBuffer().pos(16 * depth, 2, 0).tex(0, f5).endVertex(); tessellator.getBuffer().pos(0, 2, 0).tex(f2, f5).endVertex(); tessellator.draw(); tessellator.getBuffer().pos(0, 2, 0).tex(f2, f5).endVertex(); tessellator.getBuffer().pos(16 * depth, 2, 0).tex(0, f5).endVertex(); tessellator.getBuffer().pos(16 * depth, -2, 0).tex(0, 0).endVertex(); tessellator.getBuffer().pos(0 * depth, -2, 0).tex(f2, 0).endVertex(); tessellator.draw();
tess.getBuffer().pos(-8, 136, -.01).tex(0, 1).endVertex(); tess.getBuffer().pos(136, 136, -.01).tex(1, 1).endVertex(); tess.getBuffer().pos(136, -8, -.01).tex(1, 0).endVertex(); tess.getBuffer().pos(-8, -8, -.01).tex(0, 0).endVertex(); tess.draw(); tess.getBuffer().pos(8, 120, -0.015).tex(0, 1).endVertex(); tess.getBuffer().pos(120, 120, -0.015).tex(1, 1).endVertex(); tess.getBuffer().pos(120, 8, -0.015).tex(1, 0).endVertex(); tess.getBuffer().pos(8, 8, -0.015).tex(0, 0).endVertex(); tess.draw();
@SuppressWarnings("ConstantConditions") void renderFluidPlane(ResourceLocation fluid, float x, float y, float z, float size) { GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); RenderHelper.disableStandardItemLighting(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vb = tessellator.getBuffer(); TextureAtlasSprite sprite = MINECRAFT.getTextureMapBlocks().getTextureExtry(fluid.toString()); if (sprite != null) { MINECRAFT.renderEngine.bindTexture(LOCATION_BLOCKS_TEXTURE); double uMin = (double) sprite.getMinU(); double uMax = (double) sprite.getMaxU(); double vMin = (double) sprite.getMinV(); double vMax = (double) sprite.getMaxV(); vb.begin(7, POSITION_TEX); vb.pos(size / 2f, 0, size / 2f).tex(uMax, vMax).endVertex(); vb.pos(size / 2f, 0, -size / 2f).tex(uMax, vMin).endVertex(); vb.pos(-size / 2f, 0, -size / 2f).tex(uMin, vMin).endVertex(); vb.pos(-size / 2f, 0, size / 2f).tex(uMin, vMax).endVertex(); tessellator.draw(); } GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.disableBlend(); RenderHelper.enableStandardItemLighting(); GlStateManager.popMatrix(); }