List of usage examples for org.lwjgl.opengl GL11 glDisable
public static void glDisable(@NativeType("GLenum") int target)
From source file:com.kegare.caveworld.handler.CaveEventHooks.java
License:Minecraft Mod Public
@SideOnly(Side.CLIENT) @SubscribeEvent//from ww w . j av a2 s. c om public void onRenderTick(RenderTickEvent event) { if (event.phase != Phase.END) { return; } Minecraft mc = FMLClientHandler.instance().getClient(); ScaledResolution resolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); if (mc.thePlayer != null) { ItemStack current = mc.thePlayer.getCurrentEquippedItem(); if (current != null && current.getItem() != null && current.getItem() instanceof ItemMiningPickaxe) { ItemMiningPickaxe item = (ItemMiningPickaxe) current.getItem(); if (item.highlightTicks > 0) { GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); mc.fontRenderer.drawStringWithShadow(item.getModeInfomation(current), 18, resolution.getScaledHeight() - 20, 0xEEEEEE); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); --item.highlightTicks; } else { int highlight = ObfuscationReflectionHelper.getPrivateValue(GuiIngame.class, mc.ingameGUI, "remainingHighlightTicks", "field_92017_k"); if (highlight == 40) { item.highlightTicks = 800; } } } } }
From source file:com.kegare.caveworld.util.CaveUtils.java
License:Minecraft Mod Public
@SideOnly(Side.CLIENT) public static boolean renderItemStack(Minecraft mc, ItemStack itemstack, int x, int y, boolean overlay, String txt) {//from ww w. j a v a 2s .c o m GL11.glColor3f(1.0F, 1.0F, 1.0F); boolean isLightingEnabled = GL11.glIsEnabled(GL11.GL_LIGHTING); boolean rc = false; if (itemstack != null && itemstack.getItem() != null) { Block block = Block.getBlockFromItem(itemstack.getItem()); if (GameRegistry.findUniqueIdentifierFor(block).modId.equals("EnderIO") && !block.renderAsNormalBlock()) { return false; } rc = true; boolean isRescaleNormalEnabled = GL11.glIsEnabled(GL12.GL_RESCALE_NORMAL); GL11.glPushMatrix(); GL11.glTranslatef(0.0F, 0.0F, 32.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_LIGHTING); short short1 = 240; short short2 = 240; RenderHelper.enableGUIStandardItemLighting(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, short1 / 1.0F, short2 / 1.0F); RenderItem itemRender = RenderItem.getInstance(); itemRender.zLevel += 100.0F; boolean rendered; try { rendered = ForgeHooksClient.renderInventoryItem(RenderBlocks.getInstance(), mc.getTextureManager(), itemstack, itemRender.renderWithColor, itemRender.zLevel, x, y); } catch (Throwable e) { rendered = false; } if (!rendered) { try { itemRender.renderItemIntoGUI(mc.fontRenderer, mc.getTextureManager(), itemstack, x, y, true); } catch (Throwable e) { } } if (overlay) { try { itemRender.renderItemOverlayIntoGUI(mc.fontRenderer, mc.getTextureManager(), itemstack, x, y, txt); } catch (Throwable e) { } } itemRender.zLevel -= 100.0F; GL11.glPopMatrix(); if (isRescaleNormalEnabled) { GL11.glEnable(GL12.GL_RESCALE_NORMAL); } else { GL11.glDisable(GL12.GL_RESCALE_NORMAL); } } if (isLightingEnabled) { GL11.glEnable(GL11.GL_LIGHTING); } else { GL11.glDisable(GL11.GL_LIGHTING); } return rc; }
From source file:com.kegare.frozenland.client.renderer.FrozenlandWheatherRenderer.java
License:Minecraft Mod Public
@Override public void render(float ticks, WorldClient world, Minecraft mc) { ++rendererUpdateCount;//from w ww . j av a 2 s . c om float rainStrength = mc.theWorld.getRainStrength(ticks); if (rainStrength > 0.0F) { mc.entityRenderer.enableLightmap(ticks); if (rainXCoords == null) { rainXCoords = new float[1024]; rainYCoords = new float[1024]; for (int i = 0; i < 32; ++i) { for (int j = 0; j < 32; ++j) { float f1 = j - 16; float f2 = i - 16; float f3 = MathHelper.sqrt_float(f1 * f1 + f2 * f2); rainXCoords[i << 5 | j] = -f2 / f3; rainYCoords[i << 5 | j] = f1 / f3; } } } EntityLivingBase entity = mc.renderViewEntity; int x = MathHelper.floor_double(entity.posX); int y = MathHelper.floor_double(entity.posY); int z = MathHelper.floor_double(entity.posZ); Tessellator tessellator = Tessellator.instance; GL11.glDisable(GL11.GL_CULL_FACE); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * ticks; double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * ticks; double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * ticks; int i = MathHelper.floor_double(d1); byte range = 5; if (mc.gameSettings.fancyGraphics) { range = 10; } byte b1 = -1; float f1 = rendererUpdateCount + ticks; if (mc.gameSettings.fancyGraphics) { range = 10; } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); for (int j = z - range; j <= z + range; ++j) { for (int k = x - range; k <= x + range; ++k) { int index = (j - z + 16) * 32 + k - x + 16; float f2 = rainXCoords[index] * 0.5F; float f3 = rainYCoords[index] * 0.5F; int height = world.getPrecipitationHeight(k, j); int cloud = MathHelper.floor_float(world.provider.getCloudHeight()); int l = MathHelper.clamp_int(y - range, height, cloud); int m = MathHelper.clamp_int(y + range, height, cloud); if (l == cloud || m == cloud) { continue; } float f4 = 1.35F; int n = height; if (height < i) { n = i; } if (l != m) { random.setSeed(k * k * 3121 + k * 45238971 ^ j * j * 418711 + j * 13761); if (b1 != 1) { if (b1 >= 0) { tessellator.draw(); } b1 = 1; mc.getTextureManager().bindTexture(locationSnowPng); tessellator.startDrawingQuads(); } float f5 = ((rendererUpdateCount & 0x1FF) + ticks) / 512.0F; float f6 = random.nextFloat() + f1 * 0.01F * (float) random.nextGaussian(); float f7 = random.nextFloat() + f1 * (float) random.nextGaussian() * 0.001F; double xDist = k + 0.5F - entity.posX; double zDist = j + 0.5F - entity.posZ; float f8 = MathHelper.sqrt_double(xDist * xDist + zDist * zDist) / range; tessellator.setBrightness( (world.getLightBrightnessForSkyBlocks(k, n, j, 0) * 3 + 15728880) / 4); tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, ((1.0F - f8 * f8) * 0.3F + 0.5F) * rainStrength); tessellator.setTranslation(-d0 * 1.0D, -d1 * 1.0D, -d2 * 1.0D); tessellator.addVertexWithUV(k - f2 + 0.5D, l, j - f3 + 0.5D, 0.0F * f4 + f6, l * f4 / 4.0F + f5 * f4 + f7); tessellator.addVertexWithUV(k + f2 + 0.5D, l, j + f3 + 0.5D, 1.0F * f4 + f6, l * f4 / 4.0F + f5 * f4 + f7); tessellator.addVertexWithUV(k + f2 + 0.5D, m, j + f3 + 0.5D, 1.0F * f4 + f6, m * f4 / 4.0F + f5 * f4 + f7); tessellator.addVertexWithUV(k - f2 + 0.5D, m, j - f3 + 0.5D, 0.0F * f4 + f6, m * f4 / 4.0F + f5 * f4 + f7); tessellator.setTranslation(0.0D, 0.0D, 0.0D); } } } if (b1 >= 0) { tessellator.draw(); } GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); mc.entityRenderer.disableLightmap(ticks); } }
From source file:com.kegare.frozenland.client.renderer.RenderIceball.java
License:Minecraft Mod Public
@Override public void doRender(Entity entity, double posX, double posY, double posZ, float yaw, float ticks) { IIcon icon = Items.snowball.getIconFromDamage(0); if (icon != null) { GL11.glPushMatrix();/*from w ww. j ava 2 s .c o m*/ GL11.glTranslatef((float) posX, (float) posY, (float) posZ); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(0.5F, 0.5F, 0.5F); bindEntityTexture(entity); Tessellator tessellator = Tessellator.instance; int i = 0x95CBE7; float r = (i >> 16 & 255) / 255.0F; float g = (i >> 8 & 255) / 255.0F; float b = (i & 255) / 255.0F; GL11.glColor3f(r, g, b); GL11.glPushMatrix(); doRender(tessellator, icon); GL11.glPopMatrix(); GL11.glColor3f(1.0F, 1.0F, 1.0F); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } }
From source file:com.kodehawa.gui.api.render.ModGuiUtils.java
License:Open Source License
/** * Basic quad/*from www . j a v a2s .co m*/ * * @param g * @param h * @param i * @param j * @param col1 */ public static void drawRect(float g, float h, float i, float j, int col1) { float f = ((col1 >> 24) & 0xFF) / 255F; float f1 = ((col1 >> 16) & 0xFF) / 255F; float f2 = ((col1 >> 8) & 0xFF) / 255F; float f3 = (col1 & 0xFF) / 255F; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glPushMatrix(); GL11.glColor4f(f1, f2, f3, f); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2d(i, h); GL11.glVertex2d(g, h); GL11.glVertex2d(g, j); GL11.glVertex2d(i, j); GL11.glEnd(); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); }
From source file:com.kodehawa.gui.api.render.ModGuiUtils.java
License:Open Source License
/** * Gradient quad/* w w w . j a v a2 s. c om*/ * * @param x * @param y * @param x2 * @param y2 * @param col1 * @param col2 */ public static void drawGradientRect(int x, int y, int x2, int y2, int col1, int col2) { float f = ((col1 >> 24) & 0xFF) / 255F; float f1 = ((col1 >> 16) & 0xFF) / 255F; float f2 = ((col1 >> 8) & 0xFF) / 255F; float f3 = (col1 & 0xFF) / 255F; float f4 = ((col2 >> 24) & 0xFF) / 255F; float f5 = ((col2 >> 16) & 0xFF) / 255F; float f6 = ((col2 >> 8) & 0xFF) / 255F; float f7 = (col2 & 0xFF) / 255F; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glPushMatrix(); GL11.glBegin(GL11.GL_QUADS); GL11.glColor4f(f1, f2, f3, f); GL11.glVertex2d(x2, y); GL11.glVertex2d(x, y); GL11.glColor4f(f5, f6, f7, f4); GL11.glVertex2d(x, y2); GL11.glVertex2d(x2, y2); GL11.glEnd(); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glShadeModel(GL11.GL_FLAT); }
From source file:com.kodehawa.gui.api.render.ModGuiUtils.java
License:Open Source License
/** * Sideways gradient quad//w w w .j a v a 2 s. c o m * * @param x * @param y * @param x2 * @param y2 * @param col1 * @param col2 */ public static void drawSideGradientRect(float x, float y, float x2, float y2, int col1, int col2) { float f = ((col1 >> 24) & 0xFF) / 255F; float f1 = ((col1 >> 16) & 0xFF) / 255F; float f2 = ((col1 >> 8) & 0xFF) / 255F; float f3 = (col1 & 0xFF) / 255F; float f4 = ((col2 >> 24) & 0xFF) / 255F; float f5 = ((col2 >> 16) & 0xFF) / 255F; float f6 = ((col2 >> 8) & 0xFF) / 255F; float f7 = (col2 & 0xFF) / 255F; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glPushMatrix(); GL11.glBegin(GL11.GL_QUADS); GL11.glColor4f(f1, f2, f3, f); GL11.glVertex2d(x2, y); GL11.glColor4f(f5, f6, f7, f4); GL11.glVertex2d(x, y); GL11.glVertex2d(x, y2); GL11.glColor4f(f1, f2, f3, f); GL11.glVertex2d(x2, y2); GL11.glEnd(); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glShadeModel(GL11.GL_FLAT); }
From source file:com.kodehawa.gui.api.render.ModGuiUtils.java
License:Open Source License
/** * Bordered quad//w ww. ja va 2 s. c o m * * @param x * @param y * @param x2 * @param y2 * @param l1 * @param col1 * @param col2 */ public static void drawBorderedRect(int x, int y, int x2, int y2, float l1, int col1, int col2) { drawRect(x, y, x2, y2, col2); float f = ((col1 >> 24) & 0xFF) / 255F; float f1 = ((col1 >> 16) & 0xFF) / 255F; float f2 = ((col1 >> 8) & 0xFF) / 255F; float f3 = (col1 & 0xFF) / 255F; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glPushMatrix(); GL11.glColor4f(f1, f2, f3, f); GL11.glLineWidth(l1); GL11.glBegin(GL11.GL_LINES); GL11.glVertex2d(x, y); GL11.glVertex2d(x, y2); GL11.glVertex2d(x2, y2); GL11.glVertex2d(x2, y); GL11.glVertex2d(x, y); GL11.glVertex2d(x2, y); GL11.glVertex2d(x, y2); GL11.glVertex2d(x2, y2); GL11.glEnd(); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); }
From source file:com.kodehawa.gui.api.render.ModGuiUtils.java
License:Open Source License
/** * Border of a quad/*from ww w . java 2 s. co m*/ * * @param x * @param y * @param x2 * @param y2 * @param l1 * @param col1 */ public static void drawHollowBorderedRect(int x, int y, int x2, int y2, float l1, int col1) { float f = ((col1 >> 24) & 0xFF) / 255F; float f1 = ((col1 >> 16) & 0xFF) / 255F; float f2 = ((col1 >> 8) & 0xFF) / 255F; float f3 = (col1 & 0xFF) / 255F; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glPushMatrix(); GL11.glColor4f(f1, f2, f3, f); GL11.glLineWidth(l1); GL11.glBegin(GL11.GL_LINES); GL11.glVertex2d(x, y); GL11.glVertex2d(x, y2); GL11.glVertex2d(x2, y2); GL11.glVertex2d(x2, y); GL11.glVertex2d(x, y); GL11.glVertex2d(x2, y); GL11.glVertex2d(x, y2); GL11.glVertex2d(x2, y2); GL11.glEnd(); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); }
From source file:com.kodehawa.gui.api.render.ModGuiUtils.java
License:Open Source License
/** * Gradient rect with a border//from w w w . ja v a 2 s . com * * @param x * @param y * @param x2 * @param y2 * @param l1 * @param col1 * @param col2 * @param col3 */ public static void drawGradientBorderedRect(int x, int y, int x2, int y2, float l1, int col1, int col2, int col3) { drawGradientRect(x, y, x2, y2, col2, col3); float f = ((col1 >> 24) & 0xFF) / 255F; float f1 = ((col1 >> 16) & 0xFF) / 255F; float f2 = ((col1 >> 8) & 0xFF) / 255F; float f3 = (col1 & 0xFF) / 255F; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glPushMatrix(); GL11.glColor4f(f1, f2, f3, f); GL11.glLineWidth(l1); GL11.glBegin(GL11.GL_LINES); GL11.glVertex2d(x, y); GL11.glVertex2d(x, y2); GL11.glVertex2d(x2, y2); GL11.glVertex2d(x2, y); GL11.glVertex2d(x, y); GL11.glVertex2d(x2, y); GL11.glVertex2d(x, y2); GL11.glVertex2d(x2, y2); GL11.glEnd(); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); }