Java Code Examples for org.lwjgl.opengl.GL11#glEnable()
The following examples show how to use
org.lwjgl.opengl.GL11#glEnable() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Render.java From mapwriter with MIT License | 7 votes |
public static void drawCircleBorder(double x, double y, double r, double width) { GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); Tessellator tes = Tessellator.instance; tes.startDrawing(GL11.GL_TRIANGLE_STRIP); // for some the circle is only drawn if theta is decreasing rather than ascending double end = Math.PI * 2.0; double incr = end / circleSteps; double r2 = r + width; for (double theta = -incr; theta < end; theta += incr) { tes.addVertex(x + (r * Math.cos(-theta)), y + (r * Math.sin(-theta)), zDepth); tes.addVertex(x + (r2 * Math.cos(-theta)), y + (r2 * Math.sin(-theta)), zDepth); } tes.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); }
Example 2
Source File: LandscapeRenderer.java From tribaltrouble with GNU General Public License v2.0 | 6 votes |
private final void setupLandscape() { current_map_x = -1; current_map_y = -1; GL11.glEnable(GL11.GL_TEXTURE_GEN_S); GL11.glEnable(GL11.GL_TEXTURE_GEN_T); GLStateStack.switchState(GLState.VERTEX_ARRAY); if (Globals.draw_detail) { GLState.activeTexture(GL13.GL_TEXTURE1); GL11.glEnable(GL11.GL_TEXTURE_2D); bindDetail(); GL11.glEnable(GL11.GL_TEXTURE_GEN_S); GL11.glEnable(GL11.GL_TEXTURE_GEN_T); GLUtils.setupTexGen(Globals.LANDSCAPE_DETAIL_REPEAT_RATE, Globals.LANDSCAPE_DETAIL_REPEAT_RATE, 0, 0); GLState.activeTexture(GL13.GL_TEXTURE0); } GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ZERO); GL11.glEnable(GL11.GL_BLEND); }
Example 3
Source File: RenderUtilsLiving.java From bleachhack-1.14 with GNU General Public License v3.0 | 6 votes |
public static void drawText(String str, double x, double y, double z, double scale) { glSetup(x, y, z); GL11.glScaled(-0.025*scale, -0.025*scale, 0.025*scale); int i = mc.fontRenderer.getStringWidth(str) / 2; GL11.glDisable(GL11.GL_TEXTURE_2D); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR); float f = Minecraft.getInstance().gameSettings.func_216840_a(0.25F); bufferbuilder.pos(-i - 1, -1, 0.0D).color(0.0F, 0.0F, 0.0F, f).endVertex(); bufferbuilder.pos(-i - 1, 8, 0.0D).color(0.0F, 0.0F, 0.0F, f).endVertex(); bufferbuilder.pos(i + 1, 8, 0.0D).color(0.0F, 0.0F, 0.0F, f).endVertex(); bufferbuilder.pos(i + 1, -1, 0.0D).color(0.0F, 0.0F, 0.0F, f).endVertex(); tessellator.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); mc.fontRenderer.drawString(str, -i, 0, 553648127); mc.fontRenderer.drawString(str, -i, 0, -1); glCleanup(); }
Example 4
Source File: ItemEspHack.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
@Override public void onRender(float partialTicks) { // GL settings GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glLineWidth(2); GL11.glDisable(GL11.GL_LIGHTING); GL11.glPushMatrix(); RenderUtils.applyRenderOffset(); renderBoxes(partialTicks); if(style.getSelected().lines) renderTracers(partialTicks); GL11.glPopMatrix(); // GL resets GL11.glColor4f(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); }
Example 5
Source File: ItemNodeRenderer.java From Gadomancy with GNU Lesser General Public License v3.0 | 6 votes |
public static void renderNodeItem(IItemRenderer.ItemRenderType type, ItemStack item, AspectList aspects, NodeType nodeType, NodeModifier nodeModifier, Object... data) { if (type == IItemRenderer.ItemRenderType.ENTITY) { GL11.glTranslatef(-0.5F, -0.25F, -0.5F); } else if ((type == IItemRenderer.ItemRenderType.EQUIPPED) && ((data[1] instanceof EntityPlayer))) { GL11.glTranslatef(0.0F, 0.0F, -0.5F); } TileNode tjf = new TileNode(); tjf.setAspects(aspects); tjf.setNodeType(nodeType); tjf.blockType = ConfigBlocks.blockAiry; tjf.blockMetadata = 0; GL11.glPushMatrix(); GL11.glTranslated(0.5D, 0.5D, 0.5D); GL11.glScaled(2.0D, 2.0D, 2.0D); renderItemNode(tjf); GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); renderItemNode(tjf); GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); renderItemNode(tjf); GL11.glPopMatrix(); GL11.glEnable(32826); }
Example 6
Source File: CheckboxComponent.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
private void drawName(MatrixStack matrixStack, int x3, int y1) { GL11.glColor4f(1, 1, 1, 1); GL11.glEnable(GL11.GL_TEXTURE_2D); String name = setting.getName(); int tx = x3 + 2; int ty = y1 + 2; int color = setting.isLocked() ? 0xAAAAAA : 0xF0F0F0; MC.textRenderer.draw(matrixStack, name, tx, ty, color); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); }
Example 7
Source File: IngameHUD.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
@Override public void onRenderGUI(MatrixStack matrixStack, float partialTicks) { if(!WurstClient.INSTANCE.isEnabled()) return; if(tabGui == null) tabGui = new TabGui(); boolean blend = GL11.glGetBoolean(GL11.GL_BLEND); ClickGui clickGui = WurstClient.INSTANCE.getGui(); // GL settings GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_TEXTURE_2D); clickGui.updateColors(); wurstLogo.render(matrixStack); hackList.render(matrixStack, partialTicks); tabGui.render(matrixStack, partialTicks); // pinned windows if(!(WurstClient.MC.currentScreen instanceof ClickGuiScreen)) clickGui.renderPinnedWindows(matrixStack, partialTicks); // GL resets GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glColor4f(1, 1, 1, 1); if(blend) GL11.glEnable(GL11.GL_BLEND); else GL11.glDisable(GL11.GL_BLEND); }
Example 8
Source File: LWJGL15DrawContext.java From settlers-remake with MIT License | 5 votes |
void init() { GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, 0.5f); GL11.glEnable(GL11.GL_TEXTURE_2D); }
Example 9
Source File: RenderItemProgrammingPuzzle.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data){ GL11.glPushMatrix(); GL11.glDisable(GL11.GL_LIGHTING); switch(type){ case ENTITY: { GL11.glRotated(180, 0, 0, 1); GL11.glDisable(GL11.GL_CULL_FACE); render(0.0F, 0.0F, 0.0F, 0.5F, item); GL11.glEnable(GL11.GL_CULL_FACE); break; } case EQUIPPED: { GL11.glRotated(180, 0, 0, 1); render(-0.4F, -0.5F, -0.0F, 1.0F, item); // GL11.glRotated(80, 1, 0, 0); break; } case EQUIPPED_FIRST_PERSON: { GL11.glRotated(180, 0, 0, 1); render(-0.8F, -0.5F, 0.3F, 1.0F, item); break; } case INVENTORY: { GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); render(8.0F, 8.0F, 0, 12F, item); GL11.glEnable(GL11.GL_DEPTH_TEST); break; } default: break; } GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
Example 10
Source File: ModuleAirGrate.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override protected void renderModule(){ GL11.glPushMatrix(); GL11.glTranslated(0, 0, 2); rangeLineRenderer.render(); if(isFake()) { GL11.glEnable(GL11.GL_BLEND); GL11.glColor4d(1, 1, 1, 0.5); } GL11.glPopMatrix(); }
Example 11
Source File: BleachCheckbox.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public void renderButton(int int_1, int int_2, float float_1) { MinecraftClient minecraftClient_1 = MinecraftClient.getInstance(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); TextRenderer textRenderer = minecraftClient_1.textRenderer; int color = int_1 > x && int_1 < x + 10 && int_2 > y && int_2 < y + 10 ? 0xFFD0F0D0 : 0xFFA0A0A0; fill(x, y, x + 11, y + 11, 0xFF000000); fill(x, y, x + 1, y + 11, 0xff858585); fill(x, y + 10, x + 11, y + 11, color); fill(x, y, x + 10, y + 1, color); fill(x + 10, y, x + 11, y + 11, color); if (checked) fill(x + 3, y + 5, x + 8, y + 6, color); drawString(textRenderer, getMessage(), x + 15, y + 2, 0xC0C0C0); }
Example 12
Source File: NetworkConnectionPlayerHandler.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override public void render(){ super.render(); GL11.glEnable(GL11.GL_BLEND); // GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1, 1, 1, 0.5F); for(GuiStatBalloon balloon : balloons) { balloon.render(); } // GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); }
Example 13
Source File: LwjglRasteriser.java From tectonicus with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void resetState() { GL11.glColorMask(true, true, true, true); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glCullFace(GL11.GL_BACK); GL11.glFrontFace(GL11.GL_CW); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); }
Example 14
Source File: RenderLaser.java From Electro-Magic-Tools with GNU General Public License v3.0 | 4 votes |
public void renderArrow(EntityLaser entityLaser, double par2, double par4, double par6, float par8, float par9) { this.bindEntityTexture(entityLaser); GL11.glPushMatrix(); GL11.glTranslatef((float) par2, (float) par4, (float) par6); GL11.glRotatef(entityLaser.prevRotationYaw + (entityLaser.rotationYaw - entityLaser.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(entityLaser.prevRotationPitch + (entityLaser.rotationPitch - entityLaser.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.instance; byte b0 = 0; float f2 = 0.4F; float f3 = 0.7F; float f4 = (float) (0 + b0 * 10) / 32.0F; float f5 = (float) (5 + b0 * 10) / 32.0F; float f6 = 0.0F; float f7 = 0.15625F; float f8 = (float) (5 + b0 * 10) / 32.0F; float f9 = (float) (10 + b0 * 10) / 32.0F; float f10 = 0.05625F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); GL11.glScalef(f10, f10, f10); GL11.glTranslatef(-4.0F, 0.0F, 0.0F); GL11.glNormal3f(f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f9); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f9); tessellator.draw(); GL11.glNormal3f(-f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f9); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f9); tessellator.draw(); for (int i = 0; i < 4; ++i) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f10); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) f2, (double) f4); tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) f3, (double) f4); tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double) f3, (double) f5); tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double) f2, (double) f5); tessellator.draw(); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
Example 15
Source File: ItemNodeRenderer.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
public static void renderItemNode(INode node) { if (node.getAspects().size() > 0) { EntityLivingBase viewer = Minecraft.getMinecraft().renderViewEntity; float alpha = 0.5F; if (node.getNodeModifier() != null) { switch (node.getNodeModifier()) { case BRIGHT: alpha *= 1.5F; break; case PALE: alpha *= 0.66F; break; case FADING: alpha *= (MathHelper.sin(viewer.ticksExisted / 3.0F) * 0.25F + 0.33F); } } GL11.glPushMatrix(); GL11.glAlphaFunc(516, 0.003921569F); GL11.glDepthMask(false); GL11.glDisable(2884); long nt = System.nanoTime(); long time = nt / 5000000L; float bscale = 0.25F; GL11.glPushMatrix(); float rad = 6.283186F; GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha); UtilsFX.bindTexture(TileNodeRenderer.nodetex); int frames = 32; int i = (int) ((nt / 40000000L + 1L) % frames); int count = 0; float scale = 0.0F; float average = 0.0F; for (Aspect aspect : node.getAspects().getAspects()) { if (aspect.getBlend() == 771) { alpha = (float) (alpha * 1.5D); } average += node.getAspects().getAmount(aspect); GL11.glPushMatrix(); GL11.glEnable(3042); GL11.glBlendFunc(770, aspect.getBlend()); scale = MathHelper.sin(viewer.ticksExisted / (14.0F - count)) * bscale + bscale * 2.0F; scale = 0.2F + scale * (node.getAspects().getAmount(aspect) / 50.0F); UtilsFX.renderAnimatedQuadStrip(scale, alpha / node.getAspects().size(), frames, 0, i, 0.0F, aspect.getColor()); GL11.glDisable(3042); GL11.glPopMatrix(); count++; if (aspect.getBlend() == 771) { alpha = (float) (alpha / 1.5D); } } average /= node.getAspects().size(); GL11.glPushMatrix(); GL11.glEnable(3042); i = (int) ((nt / 40000000L + 1L) % frames); scale = 0.1F + average / 150.0F; int strip = 1; switch (node.getNodeType()) { case NORMAL: GL11.glBlendFunc(770, 1); break; case UNSTABLE: GL11.glBlendFunc(770, 1); strip = 6; break; case DARK: GL11.glBlendFunc(770, 771); strip = 2; break; case TAINTED: GL11.glBlendFunc(770, 771); strip = 5; break; case PURE: GL11.glBlendFunc(770, 1); strip = 4; break; case HUNGRY: scale *= 0.75F; GL11.glBlendFunc(770, 1); strip = 3; } GL11.glColor4f(1.0F, 0.0F, 1.0F, alpha); UtilsFX.renderAnimatedQuadStrip(scale, alpha, frames, strip, i, 0.0F, 16777215); GL11.glDisable(3042); GL11.glPopMatrix(); GL11.glPopMatrix(); GL11.glEnable(2884); GL11.glDepthMask(true); GL11.glAlphaFunc(516, 0.1F); GL11.glPopMatrix(); } }
Example 16
Source File: NukerHack.java From Wurst7 with GNU General Public License v3.0 | 4 votes |
@Override public void onRender(float partialTicks) { if(currentBlock == null) return; // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glLineWidth(2); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_LIGHTING); GL11.glPushMatrix(); RenderUtils.applyRenderOffset(); Box box = new Box(BlockPos.ORIGIN); float p = prevProgress + (progress - prevProgress) * partialTicks; float red = p * 2F; float green = 2 - red; GL11.glTranslated(currentBlock.getX(), currentBlock.getY(), currentBlock.getZ()); if(p < 1) { GL11.glTranslated(0.5, 0.5, 0.5); GL11.glScaled(p, p, p); GL11.glTranslated(-0.5, -0.5, -0.5); } GL11.glColor4f(red, green, 0, 0.25F); RenderUtils.drawSolidBox(box); GL11.glColor4f(red, green, 0, 0.5F); RenderUtils.drawOutlinedBox(box); GL11.glPopMatrix(); // GL resets GL11.glColor4f(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); }
Example 17
Source File: RendererSpaceElevator.java From AdvancedRocketry with MIT License | 4 votes |
@Override public void render(TileEntity tile, double x, double y, double z, float f, int damage, float a) { TileSpaceElevator multiBlockTile = (TileSpaceElevator)tile; if(!multiBlockTile.canRender()) return; double renderX = x + multiBlockTile.getLandingLocationX() - multiBlockTile.getPos().getX(); double renderZ = z + multiBlockTile.getLandingLocationZ() - multiBlockTile.getPos().getZ(); laser.doRender((Entity)null, renderX - .5, y+2.5, renderZ - .5, 0, f); GL11.glPushMatrix(); //Initial setup GL11.glTranslated(x + 0.5, y, z + .5); //Rotate and move the model into position EnumFacing front = RotatableBlock.getFront(tile.getWorld().getBlockState(tile.getPos())); GL11.glRotatef((front.getFrontOffsetX() == 1 ? 180 : 0) + front.getFrontOffsetZ()*90f, 0, 1, 0); //GL11.glTranslated(2f, 0, 0f); bindTexture(baseTexture); model.renderOnly("Base"); GL11.glPopMatrix(); //Render Beads GL11.glPushMatrix(); GL11.glTranslated(x + multiBlockTile.getLandingLocationX() - multiBlockTile.getPos().getX(), y, z + multiBlockTile.getLandingLocationZ() - multiBlockTile.getPos().getZ()); BufferBuilder buffer = Tessellator.getInstance().getBuffer(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_FOG); GL11.glEnable(GL11.GL_BLEND); GL11.glDepthMask(false); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_NORMAL); GlStateManager.color(1, 1 , 1 , 0.11f); double position = (System.currentTimeMillis() % 16000)/200f; for(int i = 0 ; i < 10; i++) { for(float radius = 0.25F; radius < 1.25; radius += .25F) { RenderHelper.renderCube(buffer, -radius, -radius + position + i*80 + 4, -radius, radius, radius + position + i*80 + 4, radius); } } for(int i = 1 ; i < 11; i++) { for(float radius = 0.25F; radius < 1.25; radius += .25F) { RenderHelper.renderCube(buffer, -radius, -radius - position + i*80 + 4, -radius, radius, radius - position + i*80 + 4, radius); } } Tessellator.getInstance().draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_FOG); GL11.glDepthMask(true); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glPopMatrix(); }
Example 18
Source File: MoCRenderDolphin.java From mocreaturesdev with GNU General Public License v3.0 | 4 votes |
@Override public void doRenderLiving(EntityLiving entityliving, double d, double d1, double d2, float f, float f1) { MoCEntityDolphin entitydolphin = (MoCEntityDolphin) entityliving; super.doRenderLiving(entitydolphin, d, d1, d2, f, f1); boolean flag = MoCreatures.proxy.getDisplayPetName() && !(entitydolphin.getName()).isEmpty(); boolean flag1 = MoCreatures.proxy.getDisplayPetHealth(); //boolean flag2 = MoCreatures.proxy.getdisplayPetIcons(); if (entitydolphin.renderName()) { float f2 = 1.6F; float f3 = 0.01666667F * f2; float f4 = entitydolphin.getDistanceToEntity(renderManager.livingPlayer); if (f4 < 16F) { String s = ""; s = (new StringBuilder()).append(s).append(entitydolphin.getName()).toString(); float f5 = 0.1F; FontRenderer fontrenderer = getFontRendererFromRenderManager(); GL11.glPushMatrix(); GL11.glTranslatef((float) d + 0.0F, (float) d1 + f5, (float) d2); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glScalef(-f3, -f3, f3); GL11.glDisable(2896 /* GL_LIGHTING */); Tessellator tessellator = Tessellator.instance; byte byte0 = -50; if (flag1) { GL11.glDisable(3553 /* GL_TEXTURE_2D */); if (!flag) { byte0 += 8; } tessellator.startDrawingQuads(); // might break SSP float f6 = entitydolphin.getHealth(); // maxhealth is always 30 for dolphins so we do not need to use a datawatcher float f7 = entitydolphin.getMaxHealth(); float f8 = f6 / f7; float f9 = 40F * f8; tessellator.setColorRGBA_F(0.7F, 0.0F, 0.0F, 1.0F); tessellator.addVertex(-20F + f9, -10 + byte0, 0.0D); tessellator.addVertex(-20F + f9, -6 + byte0, 0.0D); tessellator.addVertex(20D, -6 + byte0, 0.0D); tessellator.addVertex(20D, -10 + byte0, 0.0D); tessellator.setColorRGBA_F(0.0F, 0.7F, 0.0F, 1.0F); tessellator.addVertex(-20D, -10 + byte0, 0.0D); tessellator.addVertex(-20D, -6 + byte0, 0.0D); tessellator.addVertex(f9 - 20F, -6 + byte0, 0.0D); tessellator.addVertex(f9 - 20F, -10 + byte0, 0.0D); tessellator.draw(); GL11.glEnable(3553 /* GL_TEXTURE_2D */); } if (flag) { GL11.glDepthMask(false); GL11.glDisable(2929 /* GL_DEPTH_TEST */); GL11.glEnable(3042 /* GL_BLEND */); GL11.glBlendFunc(770, 771); GL11.glDisable(3553 /* GL_TEXTURE_2D */); tessellator.startDrawingQuads(); int i = fontrenderer.getStringWidth(s) / 2; tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); tessellator.addVertex(-i - 1, -1 + byte0, 0.0D); tessellator.addVertex(-i - 1, 8 + byte0, 0.0D); tessellator.addVertex(i + 1, 8 + byte0, 0.0D); tessellator.addVertex(i + 1, -1 + byte0, 0.0D); tessellator.draw(); GL11.glEnable(3553 /* GL_TEXTURE_2D */); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, 0x20ffffff); GL11.glEnable(2929 /* GL_DEPTH_TEST */); GL11.glDepthMask(true); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, -1); GL11.glDisable(3042 /* GL_BLEND */); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); } } }
Example 19
Source File: ModelLiquidHopper.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
@Override protected void renderMain(TileEntityOmnidirectionalHopper hopper){ if(hopper != null) { TileEntityLiquidHopper liquidHopper = (TileEntityLiquidHopper)hopper; FluidTankInfo info = liquidHopper.getTankInfo(null)[0]; int fluidAmount = info.fluid != null ? info.fluid.amount - info.capacity / 10 : 0; if(fluidAmount > 10) { GL11.glDisable(GL11.GL_LIGHTING); float percentageFull = Math.min(1, fluidAmount / (info.capacity * 0.3F)); RenderInfo renderInfo = new RenderInfo(-4 / 16F + 0.001F, 12 / 16F + 0.001F, 4 / 16F - percentageFull * 5.999F / 16F, 4 / 16F - 0.001F, 20 / 16F - 0.001F, 4 / 16F - 0.001F); RenderUtils.INSTANCE.renderLiquid(info, renderInfo, liquidHopper.getWorldObj()); fluidAmount -= info.capacity * 0.3F; if(fluidAmount > 10) { percentageFull = Math.min(1, fluidAmount / (info.capacity * 0.3F)); renderInfo = new RenderInfo(-6 / 16F + 0.001F, 10 / 16F + 0.001F, -2 / 16F - percentageFull * 0.999F / 16F, 6 / 16F - 0.001F, 22 / 16F - 0.001F, -2 / 16F - 0.001F); RenderUtils.INSTANCE.renderLiquid(info, renderInfo, liquidHopper.getWorldObj()); fluidAmount -= info.capacity * 0.3F; if(fluidAmount > 10) { percentageFull = Math.min(1, fluidAmount / (info.capacity * 0.3F)); renderInfo = new RenderInfo(6 / 16F + 0.001F, 8 / 16F + 0.001F, -2 / 16F - percentageFull * 5.999F / 16F, 8 / 16F - 0.001F, 24 / 16F - 0.001F, -2 / 16F - 0.001F); RenderUtils.INSTANCE.renderLiquid(info, renderInfo, liquidHopper.getWorldObj()); renderInfo = new RenderInfo(-8 / 16F + 0.001F, 8 / 16F + 0.001F, -2 / 16F - percentageFull * 5.999F / 16F, -6 / 16F - 0.001F, 24 / 16F - 0.001F, -2 / 16F - 0.001F); RenderUtils.INSTANCE.renderLiquid(info, renderInfo, liquidHopper.getWorldObj()); renderInfo = new RenderInfo(-6 / 16F + 0.001F, 22 / 16F + 0.001F, -2 / 16F - percentageFull * 5.999F / 16F, 6 / 16F - 0.001F, 24 / 16F - 0.001F, -2 / 16F - 0.001F); RenderUtils.INSTANCE.renderLiquid(info, renderInfo, liquidHopper.getWorldObj()); renderInfo = new RenderInfo(-6 / 16F + 0.001F, 8 / 16F + 0.001F, -2 / 16F - percentageFull * 5.999F / 16F, 6 / 16F - 0.001F, 10 / 16F - 0.001F, -2 / 16F - 0.001F); RenderUtils.INSTANCE.renderLiquid(info, renderInfo, liquidHopper.getWorldObj()); } } FMLClientHandler.instance().getClient().getTextureManager().bindTexture(getModelTexture(hopper)); GL11.glEnable(GL11.GL_LIGHTING); GL11.glColor4d(1, 1, 1, 1); } } }
Example 20
Source File: RenderCustomEndPortal.java From EnderStorage with MIT License | 4 votes |
public void render(double posX, double posY, double posZ, float frame, double playerX, double playerY, double playerZ, TextureManager r) { if(r == null)return; GL11.glDisable(GL11.GL_LIGHTING); Random random = new Random(31100L); for(int i = 0; i < 16; i++) { GL11.glPushMatrix(); float f5 = 16 - i; float f6 = 0.0625F; float f7 = 1.0F / (f5 + 1.0F); if(i == 0) { r.bindTexture(end_skyTex); f7 = 0.1F; f5 = 65F; f6 = 0.125F; GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(770, 771); } if(i == 1) { r.bindTexture(end_portalTex); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(1, 1); f6 = 0.5F; } float f8 = (float)(-(posY + surfaceY)); float f9 = f8 + ActiveRenderInfo.objectY; float f10 = f8 + f5 + ActiveRenderInfo.objectY; float f11 = f9 / f10; f11 = (float)(posY + surfaceY) + f11; GL11.glTranslated(playerX, f11, playerZ); GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_EYE_LINEAR); GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, func_40447_a(1.0F, 0.0F, 0.0F, 0.0F)); GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, func_40447_a(0.0F, 0.0F, 1.0F, 0.0F)); GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, func_40447_a(0.0F, 0.0F, 0.0F, 1.0F)); GL11.glTexGen(GL11.GL_Q, GL11.GL_EYE_PLANE, func_40447_a(0.0F, 1.0F, 0.0F, 0.0F)); GL11.glEnable(GL11.GL_TEXTURE_GEN_S); GL11.glEnable(GL11.GL_TEXTURE_GEN_T); GL11.glEnable(GL11.GL_TEXTURE_GEN_R); GL11.glEnable(GL11.GL_TEXTURE_GEN_Q); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glTranslatef(0.0F, System.currentTimeMillis() % 0xaae60L / 700000F, 0.0F); GL11.glScalef(f6, f6, f6); GL11.glTranslatef(0.5F, 0.5F, 0.0F); GL11.glRotatef((i * i * 4321 + i * 9) * 2.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(-0.5F, -0.5F, 0.0F); GL11.glTranslated(-playerX, -playerZ, -playerY); f9 = f8 + ActiveRenderInfo.objectY; GL11.glTranslated((ActiveRenderInfo.objectX * f5) / f9, (ActiveRenderInfo.objectZ * f5) / f9, -playerY + 20); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); f11 = random.nextFloat() * 0.5F + 0.1F; float f12 = random.nextFloat() * 0.5F + 0.4F; float f13 = random.nextFloat() * 0.5F + 0.5F; if(i == 0) { f11 = f12 = f13 = 1.0F; } tessellator.setColorRGBA_F(f11 * f7, f12 * f7, f13 * f7, 1.0F); tessellator.addVertex(posX + surfaceX1, posY + surfaceY, posZ + surfaceZ1); tessellator.addVertex(posX + surfaceX1, posY + surfaceY, posZ + surfaceZ2); tessellator.addVertex(posX + surfaceX2, posY + surfaceY, posZ + surfaceZ2); tessellator.addVertex(posX + surfaceX2, posY + surfaceY, posZ + surfaceZ1); tessellator.draw(); GL11.glPopMatrix(); GL11.glMatrixMode(ARBVertexBlend.GL_MODELVIEW0_ARB); } GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_GEN_S); GL11.glDisable(GL11.GL_TEXTURE_GEN_T); GL11.glDisable(GL11.GL_TEXTURE_GEN_R); GL11.glDisable(GL11.GL_TEXTURE_GEN_Q); GL11.glEnable(GL11.GL_LIGHTING); }