List of usage examples for org.lwjgl.opengl GL11 glColor3f
public static native void glColor3f(@NativeType("GLfloat") float red, @NativeType("GLfloat") float green, @NativeType("GLfloat") float blue);
From source file:vazkii.botania.client.render.tile.RenderTileRuneAltar.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partticks) { TileRuneAltar altar = (TileRuneAltar) tileentity; GL11.glPushMatrix();/*from ww w.j av a2s.co m*/ GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glTranslated(x, y, z); int items = 0; for (int i = 0; i < altar.getSizeInventory(); i++) if (altar.getStackInSlot(i) == null) break; else items++; float[] angles = new float[altar.getSizeInventory()]; float anglePer = 360F / items; float totalAngle = 0F; for (int i = 0; i < angles.length; i++) angles[i] = totalAngle += anglePer; double time = ClientTickHandler.ticksInGame + partticks; for (int i = 0; i < altar.getSizeInventory(); i++) { GL11.glPushMatrix(); GL11.glScalef(0.5F, 0.5F, 0.5F); GL11.glTranslatef(1F, 2.5F, 1F); GL11.glRotatef(angles[i] + (float) time, 0F, 1F, 0F); GL11.glTranslatef(2.25F, 0F, 0.5F); GL11.glRotatef(90F, 0F, 1F, 0F); GL11.glTranslated(0D, 0.15 * Math.sin((time + i * 10) / 5D), 0F); ItemStack stack = altar.getStackInSlot(i); Minecraft mc = Minecraft.getMinecraft(); if (stack != null) { mc.renderEngine.bindTexture(stack.getItem() instanceof ItemBlock ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture); GL11.glScalef(2F, 2F, 2F); if (!ForgeHooksClient.renderEntityItem( new EntityItem(altar.getWorldObj(), altar.xCoord, altar.yCoord, altar.zCoord, stack), stack, 0F, 0F, altar.getWorldObj().rand, mc.renderEngine, renderBlocks, 1)) { GL11.glScalef(0.5F, 0.5F, 0.5F); if (stack.getItem() instanceof ItemBlock && RenderBlocks .renderItemIn3d(Block.getBlockFromItem(stack.getItem()).getRenderType())) { GL11.glScalef(0.5F, 0.5F, 0.5F); GL11.glTranslatef(1F, 1.1F, 0F); renderBlocks.renderBlockAsItem(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 1F); GL11.glTranslatef(-1F, -1.1F, 0F); GL11.glScalef(2F, 2F, 2F); } else { int renderPass = 0; do { IIcon icon = stack.getItem().getIcon(stack, renderPass); if (icon != null) { Color color = new Color(stack.getItem().getColorFromItemStack(stack, renderPass)); GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()); float f = icon.getMinU(); float f1 = icon.getMaxU(); float f2 = icon.getMinV(); float f3 = icon.getMaxV(); ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); GL11.glColor3f(1F, 1F, 1F); } renderPass++; } while (renderPass < stack.getItem().getRenderPasses(stack.getItemDamage())); } } } GL11.glPopMatrix(); } GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glPushMatrix(); GL11.glTranslatef(0.5F, 1.8F, 0.5F); GL11.glRotatef(180F, 1F, 0F, 1F); int repeat = 15; cubes.renderSpinningCubes(2, repeat, repeat); GL11.glPopMatrix(); GL11.glTranslatef(0F, 0.2F, 0F); float scale = altar.getTargetMana() == 0 ? 0 : (float) altar.getCurrentMana() / (float) altar.getTargetMana() / 75F; if (scale != 0) { int seed = altar.xCoord ^ altar.yCoord ^ altar.zCoord; GL11.glTranslatef(0.5F, 0.7F, 0.5F); RenderHelper.renderStar(0x00E4D7, scale, scale, scale, seed); } GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glPopMatrix(); }
From source file:vazkii.botania.client.render.tile.RenderTileSparkChanger.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float pticks) { GL11.glPushMatrix();/* w w w . j av a 2 s .c om*/ GL11.glTranslated(d0, d1, d2); GL11.glRotated(90F, 1F, 0F, 0F); GL11.glTranslatef(0.8F, 0.2F, -0.22F); GL11.glColor4f(1F, 1F, 1F, 1F); ItemStack stack = ((TileSparkChanger) tileentity).getStackInSlot(0); if (stack != null) { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); float s = 0.6F; GL11.glScalef(s, s, s); GL11.glRotatef(180F, 0F, 1F, 0F); int renderPass = 0; do { IIcon icon = stack.getItem().getIcon(stack, renderPass); if (icon != null) { Color color = new Color(stack.getItem().getColorFromItemStack(stack, renderPass)); GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()); float f = icon.getMinU(); float f1 = icon.getMaxU(); float f2 = icon.getMinV(); float f3 = icon.getMaxV(); ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); GL11.glColor3f(1F, 1F, 1F); } renderPass++; } while (renderPass < stack.getItem().getRenderPasses(stack.getItemDamage())); GL11.glPopMatrix(); } GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glPopMatrix(); }
From source file:vazkii.botania.client.render.tile.RenderTileSpawnerClaw.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity var1, double d0, double d1, double d2, float var8) { GL11.glPushMatrix();//ww w .j a v a 2s . com GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glTranslated(d0, d1, d2); Minecraft.getMinecraft().renderEngine.bindTexture(texture); GL11.glTranslatef(0.5F, 1.5F, 0.5F); GL11.glScalef(1F, -1F, -1F); model.render(); GL11.glColor3f(1F, 1F, 1F); GL11.glScalef(1F, -1F, -1F); GL11.glPopMatrix(); }
From source file:vazkii.botania.client.render.tile.RenderTileSpreader.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float ticks) { TileSpreader spreader = (TileSpreader) tileentity; GL11.glPushMatrix();//from w ww . ja v a 2 s .com GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glTranslated(d0, d1, d2); GL11.glTranslatef(0.5F, 1.5F, 0.5F); GL11.glRotatef(spreader.rotationX + 90F, 0F, 1F, 0F); GL11.glTranslatef(0F, -1F, 0F); GL11.glRotatef(spreader.rotationY, 1F, 0F, 0F); GL11.glTranslatef(0F, 1F, 0F); Minecraft.getMinecraft().renderEngine .bindTexture(spreader.isRedstone() ? textureRs : spreader.isDreamwood() ? textureDw : texture); GL11.glScalef(1F, -1F, -1F); double time = ClientTickHandler.ticksInGame + ticks; if (spreader.isULTRA_SPREADER()) { Color color = Color.getHSBColor((float) ((time * 5 + new Random(spreader.xCoord ^ spreader.yCoord ^ spreader.zCoord).nextInt(10000)) % 360) / 360F, 0.4F, 0.9F); GL11.glColor3f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F); } model.render(); GL11.glColor3f(1F, 1F, 1F); GL11.glPushMatrix(); double worldTicks = tileentity.getWorldObj() == null ? 0 : time; GL11.glRotatef((float) worldTicks % 360, 0F, 1F, 0F); GL11.glTranslatef(0F, (float) Math.sin(worldTicks / 20.0) * 0.05F, 0F); model.renderCube(); GL11.glPopMatrix(); GL11.glScalef(1F, -1F, -1F); ItemStack stack = spreader.getStackInSlot(0); if (stack != null) { Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); ILens lens = (ILens) stack.getItem(); GL11.glPushMatrix(); GL11.glTranslatef(-0.4F, -1.4F, -0.4375F); GL11.glScalef(0.8F, 0.8F, 0.8F); RenderLens.render(stack, lens.getLensColor(stack)); GL11.glPopMatrix(); } if (spreader.paddingColor != -1) { Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); Block block = Blocks.carpet; int color = spreader.paddingColor; RenderBlocks render = RenderBlocks.getInstance(); float f = 1F / 16F; GL11.glTranslatef(0F, -f, 0F); render.renderBlockAsItem(block, color, 1F); GL11.glTranslatef(0F, -f * 15, 0F); render.renderBlockAsItem(block, color, 1F); GL11.glRotatef(90F, 1F, 0F, 0F); GL11.glRotatef(90F, 0F, 1F, 0F); GL11.glPushMatrix(); GL11.glScalef(f * 14F, 1F, 1F); render.renderBlockAsItem(block, color, 1F); GL11.glPopMatrix(); GL11.glRotatef(90F, 1F, 0F, 0F); GL11.glTranslatef(0F, 0F, -f / 2); GL11.glScalef(f * 14F, 1F, f * 15F); render.renderBlockAsItem(block, color, 1F); GL11.glTranslatef(0F, f * 15F, 0F); render.renderBlockAsItem(block, color, 1F); } GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:vazkii.botania.client.render.tile.RenderTileTinyPotato.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity var1, double d0, double d1, double d2, float var8) { TileTinyPotato potato = (TileTinyPotato) var1; GL11.glPushMatrix();// w w w .j a v a2s . com GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glTranslated(d0, d1, d2); Minecraft mc = Minecraft.getMinecraft(); mc.renderEngine.bindTexture(texture); GL11.glTranslatef(0.5F, 1.5F, 0.5F); GL11.glScalef(1F, -1F, -1F); int meta = potato.getWorldObj() == null ? 3 : potato.getBlockMetadata(); float rotY = meta * 90F - 180F; GL11.glRotatef(rotY, 0F, 1F, 0F); float jump = potato.jumpTicks; if (jump > 0) jump += var8; float up = (float) -Math.abs(Math.sin(jump / 10 * Math.PI)) * 0.2F; float rotZ = (float) Math.sin(jump / 10 * Math.PI) * 2; GL11.glTranslatef(0F, up, 0F); GL11.glRotatef(rotZ, 0F, 0F, 1F); model.render(); GL11.glRotatef(-rotZ, 0F, 0F, 1F); GL11.glRotatef(-rotY, 0F, 1F, 0F); GL11.glColor3f(1F, 1F, 1F); GL11.glScalef(1F, -1F, -1F); if (!potato.name.isEmpty()) { GL11.glPushMatrix(); GL11.glTranslatef(0F, -0.6F, 0F); GL11.glRotatef(-RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F); float f = 1.6F; float f1 = 0.016666668F * f; GL11.glScalef(-f1, -f1, f1); GL11.glDisable(GL11.GL_LIGHTING); GL11.glTranslatef(0.0F, 0F / f1, 0.0F); GL11.glDepthMask(false); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); Tessellator tessellator = Tessellator.instance; GL11.glDisable(GL11.GL_TEXTURE_2D); tessellator.startDrawingQuads(); int i = mc.fontRenderer.getStringWidth(potato.name) / 2; tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); tessellator.addVertex(-i - 1, -1.0D, 0.0D); tessellator.addVertex(-i - 1, 8.0D, 0.0D); tessellator.addVertex(i + 1, 8.0D, 0.0D); tessellator.addVertex(i + 1, -1.0D, 0.0D); tessellator.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); mc.fontRenderer.drawString(potato.name, -mc.fontRenderer.getStringWidth(potato.name) / 2, 0, 0xFFFFFF); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glScalef(1F / -f1, 1F / -f1, 1F / f1); GL11.glPopMatrix(); } GL11.glPopMatrix(); }
From source file:vazkii.botania.common.item.relic.ItemFlugelEye.java
License:Open Source License
@SideOnly(Side.CLIENT) public void render(ItemStack stack, EntityPlayer player, float partialTicks) { Minecraft mc = Minecraft.getMinecraft(); Tessellator tess = Tessellator.instance; Tessellator.renderingWorldRenderer = false; GL11.glPushMatrix();/*from w ww . ja v a2 s . co m*/ GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); float alpha = ((float) Math.sin((ClientTickHandler.ticksInGame + partialTicks) * 0.2F) * 0.5F + 0.5F) * 0.4F + 0.3F; double posX = player.prevPosX + (player.posX - player.prevPosX) * partialTicks; double posY = player.prevPosY + (player.posY - player.prevPosY) * partialTicks; double posZ = player.prevPosZ + (player.posZ - player.prevPosZ) * partialTicks; GL11.glTranslated(posX - RenderManager.renderPosX, posY - RenderManager.renderPosY, posZ - RenderManager.renderPosZ); float base = getRotationBase(stack); int angles = 360; int segAngles = angles / SEGMENTS; float shift = base - segAngles / 2; float u = 1F; float v = 0.25F; float s = 3F; float m = 0.8F; float y = v * s * 2; float y0 = 0; int segmentLookedAt = getSegmentLookedAt(stack, player); for (int seg = 0; seg < SEGMENTS; seg++) { boolean inside = false; float rotationAngle = (seg + 0.5F) * segAngles + shift; if (segmentLookedAt == seg) inside = true; GL11.glPushMatrix(); GL11.glRotatef(rotationAngle, 0F, 1F, 0F); GL11.glTranslatef(s * m, -0.75F, 0F); mc.renderEngine.bindTexture(TextureMap.locationItemsTexture); GL11.glScalef(0.75F, 0.75F, 0.75F); GL11.glTranslatef(0F, 0F, 0.5F); IIcon icon = signs[seg]; GL11.glRotatef(90F, 0F, 1F, 0F); GL11.glColor4f(1F, 1F, 1F, getWarpPoint(stack, seg).isValid() ? 1F : 0.2F); float f = icon.getMinU(); float f1 = icon.getMaxU(); float f2 = icon.getMinV(); float f3 = icon.getMaxV(); ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); GL11.glColor3f(1F, 1F, 1F); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glRotatef(180F, 1F, 0F, 0F); float a = alpha; if (inside) { a += 0.3F; y0 = -y; } if (seg % 2 == 0) GL11.glColor4f(0.6F, 0.6F, 0.6F, a); else GL11.glColor4f(1F, 1F, 1F, a); mc.renderEngine.bindTexture(glowTexture); tess.startDrawingQuads(); for (int i = 0; i < segAngles; i++) { float ang = i + seg * segAngles + shift; double xp = Math.cos(ang * Math.PI / 180F) * s; double zp = Math.sin(ang * Math.PI / 180F) * s; tess.addVertexWithUV(xp * m, y, zp * m, u, v); tess.addVertexWithUV(xp, y0, zp, u, 0); xp = Math.cos((ang + 1) * Math.PI / 180F) * s; zp = Math.sin((ang + 1) * Math.PI / 180F) * s; tess.addVertexWithUV(xp, y0, zp, 0, 0); tess.addVertexWithUV(xp * m, y, zp * m, 0, v); } y0 = 0; tess.draw(); GL11.glPopMatrix(); } GL11.glPopMatrix(); }
From source file:vazkii.b_baubles.common.item.equipment.bauble.ItemFlightTiara.java
License:Open Source License
@Override @SideOnly(Side.CLIENT)//from w w w . j a v a 2 s. c o m public void onPlayerBaubleRender(ItemStack stack, RenderPlayerEvent event, RenderType type) { int meta = stack.getItemDamage(); if (type == RenderType.BODY) { if (meta > 0 && meta <= ItemFlightTiara.wingIcons.length) { IIcon icon = ItemFlightTiara.wingIcons[meta - 1]; Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); boolean flying = event.entityPlayer.capabilities.isFlying; float rz = 120F; float rx = 20F + (float) ((Math.sin((double) (event.entityPlayer.ticksExisted + event.partialRenderTick) * (flying ? 0.4F : 0.2F)) + 0.5F) * (flying ? 30F : 5F)); float ry = 0F; float h = 0.2F; float i = 0.15F; float s = 1F; GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1F, 1F, 1F, 1F); int light = 15728880; int lightmapX = light % 65536; int lightmapY = light / 65536; switch (meta) { case 1: { // White wing h = 0.4F; break; } case 2: { // Black wing s = 1.3F; break; } case 3: { // Ice fairy h = -0.1F; rz = 0F; rx = 0F; i = 0.3F; break; } case 4: { // Phoenix rz = 180F; h = 0.5F; rx = 20F; ry = -(float) ((Math.sin((double) (event.entityPlayer.ticksExisted + event.partialRenderTick) * (flying ? 0.4F : 0.2F)) + 0.6F) * (flying ? 30F : 5F)); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY); break; } case 5: { // Pixie h = -0.1F; rz = 0F; ry = -rx; rx = 0F; GL11.glColor4f(1F, 1F, 1F, 0.5F + (float) Math.cos( (double) (event.entityPlayer.ticksExisted + event.partialRenderTick) * 0.3F) * 0.2F); break; } } float f = icon.getMinU(); float f1 = icon.getMaxU(); float f2 = icon.getMinV(); float f3 = icon.getMaxV(); float sr = 1F / s; Helper.rotateIfSneaking(event.entityPlayer); GL11.glTranslatef(0F, h, i); GL11.glRotatef(rz, 0F, 0F, 1F); GL11.glRotatef(rx, 1F, 0F, 0F); GL11.glRotatef(ry, 0F, 1F, 0F); GL11.glScalef(s, s, s); ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 32F); GL11.glScalef(sr, sr, sr); GL11.glRotatef(-ry, 0F, 1F, 0F); GL11.glRotatef(-rx, 1F, 0F, 0F); GL11.glRotatef(-rz, 0F, 0F, 1F); if (meta != 0) { // Sephiroth GL11.glScalef(-1F, 1F, 1F); GL11.glRotatef(rz, 0F, 0F, 1F); GL11.glRotatef(rx, 1F, 0F, 0F); GL11.glRotatef(ry, 0F, 1F, 0F); GL11.glScalef(s, s, s); ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 32F); GL11.glScalef(sr, sr, sr); GL11.glRotatef(-ry, 1F, 0F, 0F); GL11.glRotatef(-rx, 1F, 0F, 0F); GL11.glRotatef(-rz, 0F, 0F, 1F); } GL11.glColor3f(1F, 1F, 1F); GL11.glPopMatrix(); } } }
From source file:vazkii.kap.client.util.helper.RenderHelper.java
License:Creative Commons License
public static void renderCrest(CrestData crest, double x, double y, double z, boolean bg, boolean lighting) { GL11.glPushMatrix();/* w w w. j a va 2s . c om*/ boolean lightingEnabled = GL11.glGetBoolean(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_LIGHTING); int ssx = crest.icon % 32; int ssy = crest.icon / 32; float scale = 1 / 32F; if (bg) { Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation(LibResources.ICON_HERALDRY_0)); int color = crest.color1; Color colorRGB = new Color(color); GL11.glColor3f(colorRGB.getRed() / 255F, colorRGB.getGreen() / 255F, colorRGB.getBlue() / 255F); drawTexturedQuad(x, y, z - 0.01, 64, 64, ssx * scale, (ssx + 1) * scale, ssy * scale, (ssy + 1) * scale); } Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation(LibResources.ICON_HERALDRY_1)); int color1 = crest.color2; Color colorRGB = new Color(color1); GL11.glColor3f(colorRGB.getRed() / 255F, colorRGB.getGreen() / 255F, colorRGB.getBlue() / 255F); drawTexturedQuad(x, y, z + 2, 64, 64, ssx * scale, (ssx + 1) * scale, ssy * scale, (ssy + 1) * scale); if (!lightingEnabled) GL11.glDisable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:vazkii.priscemagica.client.core.helper.RenderHelper.java
License:Creative Commons License
public static void renderIcon(int x, int y, Icon icon, int color) { GL11.glColor3ub((byte) ((color >> 16) & 255), (byte) ((color >> 8) & 255), (byte) (color & 255)); itemRenderer.renderIcon(x, y, icon, 16, 16); GL11.glColor3f(1F, 1F, 1F); }
From source file:vazkii.quark.client.render.RenderCreeperAngry.java
License:Creative Commons License
@Override protected ResourceLocation getEntityTexture(EntityCreeper entity) { if (entity.getCreeperState() == 1) { float antired = 1F - (entity.getCreeperFlashIntensity(0F) / 1.17F + 0.1F); GL11.glColor3f(1F, antired, antired); }// w w w. j a v a 2 s .co m return super.getEntityTexture(entity); }