List of usage examples for org.lwjgl.opengl GL11 glEnable
public static void glEnable(@NativeType("GLenum") int target)
From source file:buildcraftAdditions.client.render.BucketItemRenderer.java
License:GNU General Public License
private void renderMask(IIcon mask, IIcon subIcon, ItemRenderType type, boolean flip) { if (mask == null || subIcon == null) return;// ww w.ja v a 2 s. c om GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_CULL_FACE); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, 1); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(mask, 0.001, flip); else preRenderWorldIcon(mask, 0.001, flip); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, -1); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(mask, -0.0635, flip); else preRenderWorldIcon(mask, -0.0635, flip); tessellator.draw(); Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_BLOCK_SHEET); GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDepthMask(false); tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, 1); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(subIcon, 0.001, flip); else preRenderWorldIcon(subIcon, 0.001, flip); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, -1); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(subIcon, -0.0635, flip); else preRenderWorldIcon(subIcon, -0.0635, flip); tessellator.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glColor4f(1, 1, 1, 1); }
From source file:buildcraftAdditions.client.render.CanisterItemRender.java
License:GNU General Public License
private void renderMask(IIcon mask, IIcon subIcon, ItemRenderType type) { if (mask == null || subIcon == null) return;//from ww w. j a va 2 s . c o m GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_ALPHA_TEST); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, 1.0F); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(mask, 0.001D); else preRenderWorldIcon(mask, 0.001D); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1.0F); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(mask, -0.0635D); else preRenderWorldIcon(mask, -0.0635D); tessellator.draw(); Minecraft.getMinecraft().renderEngine.bindTexture(BLOCK_TEXTURE); GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDepthMask(false); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, 1.0F); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(subIcon, 0.001D); else preRenderWorldIcon(subIcon, 0.001D); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1.0F); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(subIcon, -0.0635D); else preRenderWorldIcon(subIcon, -0.0635D); tessellator.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); }
From source file:buildcraftAdditions.client.render.entities.EntityLaserShotRenderer.java
License:GNU General Public License
private void doRender(EntityLaserShot entity, double x, double y, double z, float rotation, float partialTicks) { bindEntityTexture(entity);/*from w ww .j a v a 2 s . c o m*/ GL11.glPushMatrix(); float strength = entity.getStrength(); if (strength >= 1) GL11.glColor3f(1, 0, 0); else if (strength > 0.75) GL11.glColor3f(0.75F, 0, 0.25F); else if (strength > 0.6) GL11.glColor3f(0.5F, 0, 0.5F); else if (strength > 0.35) GL11.glColor3f(0.25F, 0, 0.75F); else GL11.glColor3f(0, 0, 1); GL11.glTranslated(x, y, z); GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks - 90, 0, 1, 0); GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 0, 0, 1); Tessellator t = Tessellator.instance; double d1 = 0; double d2 = 0.5; double d3 = 0 / 32D; double d4 = 5 / 32D; double d5 = 0.05625; GL11.glEnable(GL12.GL_RESCALE_NORMAL); float f1 = entity.throwableShake - partialTicks; if (f1 > 0) { float f2 = -MathHelper.sin(f1 * 3) * f1; GL11.glRotatef(f2, 0, 0, 1); } GL11.glRotatef(45, 1, 0, 0); GL11.glScaled(d5, d5, d5); GL11.glTranslatef(-4, 0, 0); for (int i = 0; i < 4; i++) { GL11.glRotatef(90, 1, 0, 0); GL11.glNormal3d(0, 0, d5); t.startDrawingQuads(); t.addVertexWithUV(-8, -2, 0, d1, d3); t.addVertexWithUV(8, -2, 0, d2, d3); t.addVertexWithUV(8, 2, 0, d2, d4); t.addVertexWithUV(-8, 2, 0, d1, d4); t.draw(); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:buildcraftAdditions.client.render.items.CanisterItemRender.java
License:GNU General Public License
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { if (item == null || item.getItem() == null || !(item.getItem() instanceof ItemCanister)) return;//from w w w.jav a 2 s . com ItemCanister canister = (ItemCanister) item.getItem(); IIcon overlay = canister.getOverlay(); IIcon canisterIcon = canister.getIconFromDamage(0); GL11.glPushMatrix(); GL11.glEnable(GL11.GL_ALPHA_TEST); if (type.equals(ItemRenderType.EQUIPPED)) { GL11.glRotated(180, 0, 0, 1); GL11.glTranslated(-1, -1, 0); } else if (type.equals(ItemRenderType.ENTITY)) { GL11.glRotated(180, 0, 0, 1); GL11.glRotated(90, 0, 1, 0); GL11.glTranslated(-0.5, -0.9, 0); if (item.isOnItemFrame()) { GL11.glTranslated(0.075, 0.475, 0); GL11.glScaled(0.85, 0.85, 0.85); } } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) { GL11.glTranslated(1, 1, 0); GL11.glRotated(180, 0, 0, 1); } FluidStack fluid = Utils.getFluidStackFromItemStack(item); if (fluid != null) { Fluid f = fluid.getFluid(); if (f != null) { Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_ITEM_SHEET); renderMask(overlay, f.getIcon(), type); } } Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_ITEM_SHEET); if (type.equals(ItemRenderType.INVENTORY)) renderIcon(canisterIcon, 0); else ItemRenderer.renderItemIn2D(Tessellator.instance, canisterIcon.getMinU(), canisterIcon.getMaxV(), canisterIcon.getMaxU(), canisterIcon.getMinV(), canisterIcon.getIconWidth(), canisterIcon.getIconHeight(), 0.0625F); GL11.glColor4f(1, 1, 1, 1); GL11.glPopMatrix(); }
From source file:buildcraftAdditions.client.render.items.CanisterItemRender.java
License:GNU General Public License
private void renderMask(IIcon mask, IIcon subIcon, ItemRenderType type) { if (mask == null || subIcon == null) return;// w ww . j a v a2 s. c o m GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_CULL_FACE); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, 1); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(mask, 0.001); else preRenderWorldIcon(mask, 0.001); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, -1); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(mask, -0.0635); else preRenderWorldIcon(mask, -0.0635); tessellator.draw(); Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_BLOCK_SHEET); GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDepthMask(false); tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, 1); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(subIcon, 0.001); else preRenderWorldIcon(subIcon, 0.001); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, -1); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(subIcon, -0.0635); else preRenderWorldIcon(subIcon, -0.0635); tessellator.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glColor4f(1, 1, 1, 1); }
From source file:buildcraftAdditions.client.render.KineticToolItemRender.java
License:GNU General Public License
private void renderMask(IIcon mask, IIcon subIcon, ItemRenderType type) { if (mask == null || subIcon == null) return;/*from www . jav a2 s . c om*/ GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_ALPHA_TEST); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, 1.0F); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(mask, 0.001D); else preRenderWorldIcon(mask, 0.001D); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1.0F); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(mask, -0.0635D); else preRenderWorldIcon(mask, -0.0635D); tessellator.draw(); Minecraft.getMinecraft().renderEngine.bindTexture(BLOCK_TEXTURE); GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDepthMask(false); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, 1.0F); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(subIcon, 0.001D); else preRenderWorldIcon(subIcon, 0.001D); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1.0F); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(subIcon, -0.0635D); else preRenderWorldIcon(subIcon, -0.0635D); tessellator.draw(); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); }
From source file:ccm.burialservices.client.renderers.GraveRenderer.java
License:Open Source License
private static void renderItemHolding(int i, int meta, ItemStack stack, double x, double y, double z, float tickTime) { Icon icon = stack.getItem().getIcon(stack, i); if (icon == null) return;/*from w ww. ja va2 s .c om*/ GL11.glPushMatrix(); GL11.glTranslated(x, y, z); //Center to block switch (meta) { case 0: break; case 1: GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F); GL11.glTranslated(-1, 0, 0); break; case 2: GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F); GL11.glTranslated(-1, 0, -1); break; case 3: GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F); GL11.glTranslated(0, 0, -1); break; } if (stack.getItem() instanceof ItemSword) { GL11.glTranslated(0.44, 0.1d, 1.85); GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F); } else { GL11.glTranslated(0.5, 0.1d, 0.5); } GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F); TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager(); texturemanager.bindTexture(texturemanager.getResourceLocation(stack.getItemSpriteNumber())); Tessellator tessellator = Tessellator.instance; GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glTranslatef(0.65f, 0.6f, -0.1f); // Center on block GL11.glRotatef(135f, 0, 0, 1); ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.06F); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:ccm.placeableTools.client.ToolRenderer.java
License:Open Source License
public static void doRenderPass(int i, int meta, ItemStack stack, double x, double y, double z) { Icon icon = stack.getItem().getIcon(stack, i); if (icon == null) return;/*w w w . j a v a 2 s. c o m*/ GL11.glPushMatrix(); TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager(); texturemanager.bindTexture(texturemanager.getResourceLocation(stack.getItemSpriteNumber())); Tessellator tessellator = Tessellator.instance; GL11.glTranslated(x, y, z); //Center to block GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glTranslatef(-0.5f, .5f, 0.5f); // Center on block if (stack.getItem() instanceof ItemSpade || stack.getItem() instanceof ItemHoe) { float shift = 0.3f; switch (ForgeDirection.values()[meta]) { case NORTH: GL11.glTranslatef(0, 0, -shift); GL11.glRotatef(15f, -0.5f, 0, 0); break; case SOUTH: GL11.glTranslatef(0, 0, shift); GL11.glRotatef(-15f, -0.5f, 0, 0); break; case EAST: GL11.glRotatef(90f, 0, 1, 0); GL11.glTranslatef(-1, 0, 1); GL11.glTranslatef(0, 0, shift); GL11.glRotatef(-15f, -0.5f, 0, 0); break; case WEST: GL11.glRotatef(90f, 0, 1, 0); GL11.glTranslatef(-1, 0, 1); GL11.glTranslatef(0, 0, -shift); GL11.glRotatef(15f, -0.5f, 0, 0); break; case DOWN: GL11.glRotatef(90f, 0, 1, 0); GL11.glTranslatef(-1, 0, 1); break; } GL11.glTranslatef(0, 0, -0.03f); //Icon depth of the shovel GL11.glRotatef(180f, 1, 0, 0); } else if (stack.getItem() instanceof ItemAxe || stack.getItem() instanceof ItemPickaxe) { float shift = 0.15f; switch (ForgeDirection.values()[meta]) { case NORTH: GL11.glRotatef(90f, 0, 1, 0); GL11.glTranslatef(-1, 0, 1); GL11.glTranslatef(shift, 0, 0); GL11.glRotatef(-10f, 0, 0, 1); break; case SOUTH: GL11.glRotatef(-90f, 0, 1, 0); GL11.glTranslatef(-1, 0, -1); GL11.glTranslatef(shift, 0, 0); GL11.glRotatef(-10f, 0, 0, 1); break; case EAST: GL11.glTranslatef(shift, 0, 0); GL11.glRotatef(-10f, 0, 0, 1); break; case WEST: GL11.glRotatef(180f, 0, 1, 0); GL11.glTranslatef(-2, 0, 0); GL11.glTranslatef(shift, 0, 0); GL11.glRotatef(-10f, 0, 0, 1); break; } GL11.glTranslatef(0, 0, 0.03F); } else if (stack.getItem() instanceof ItemSword) { float shift = 0.15f; switch (ForgeDirection.values()[meta]) { case NORTH: GL11.glRotatef(90f, 0, 1, 0); GL11.glTranslatef(shift, 0, 0); GL11.glRotatef(-90f, 0, 0, 1); GL11.glTranslatef(-1, 0, 1); break; case SOUTH: GL11.glRotatef(-90f, 0, 1, 0); GL11.glTranslatef(shift, 0, 0); GL11.glRotatef(-90f, 0, 0, 1); GL11.glTranslatef(-1, 0, -1); break; case EAST: GL11.glTranslatef(shift, 0, 0); GL11.glRotatef(-90f, 0, 0, 1); GL11.glTranslatef(-1, 1, 0); break; case WEST: GL11.glRotatef(180f, 0, 1, 0); GL11.glTranslatef(-1, 1, 0); GL11.glTranslatef(shift, 0, 0); GL11.glRotatef(-90f, 0, 0, 1); break; case UP: GL11.glRotatef(180f, 1, 0, 0); GL11.glTranslatef(1, 0, 1); GL11.glRotatef(90f, 0, 1, 0); break; case DOWN: GL11.glRotatef(180f, 1, 0, 0); break; } GL11.glTranslatef(-0.05f, 0, 0.03F); } GL11.glRotatef(-45f, 0, 0, 1); GL11.glScalef(1.5f, 1.5f, 1.5f); ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.06F / 1.5f); if (stack.hasEffect(i)) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); texturemanager.bindTexture(RES_ITEM_GLINT); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f7 = 0.76F; GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); float f8 = 0.125F; GL11.glScalef(f8, f8, f8); float f9 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F; GL11.glTranslatef(f9, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.06F / 1.5f); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f8, f8, f8); f9 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F; GL11.glTranslatef(-f9, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.06F / 1.5f); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:cellularautomata.CellularAutomata.java
public static void renderGL() { try { //Trys to create a game window size 500x700. Display.setDisplayMode(new org.lwjgl.opengl.DisplayMode(800, 600)); Display.create();/*w ww.j ava 2 s. c o m*/ } catch (LWJGLException e) { //Catches exception if game window is not created. e.printStackTrace(); System.exit(0); } GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_LIGHTING); GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); //Sets colour to white. GL11.glClearDepth(1); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glViewport(0, 0, 800, 600); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, 800, 600, 0, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); Display.setVSyncEnabled(vsync); }
From source file:cellularautomata.CellularAutomata.java
public static void drawTitle(TrueTypeFont trueTypeTitleFont, TrueTypeFont trueTypePaintBrushFont, TrueTypeFont trueTypeDimensionsFont) { GL11.glEnable(GL11.GL_TEXTURE_2D); //Enables textures. trueTypeTitleFont.drawString((800 - trueTypeTitleFont.getWidth("Cellular Automata")) / 2, (600 - trueTypeTitleFont.getHeight("Cellular Automata")) / 2, "Cellular Automata", Color.white); trueTypeDimensionsFont.drawString(650, 570, "By Carson Craig", Color.white); GL11.glDisable(GL11.GL_TEXTURE_2D); //Disables textures. }