List of usage examples for org.lwjgl.opengl GL11 glBlendFunc
public static void glBlendFunc(@NativeType("GLenum") int sfactor, @NativeType("GLenum") int dfactor)
From source file:mods.railcraft.client.render.carts.RenderItemLocomotive.java
License:Open Source License
private void render(ItemStack stack, float scale) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_DEPTH_TEST);/*from ww w. java 2s . com*/ GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glScalef(scale, scale, scale); entity.rotationYaw = 0; entity.rotationPitch = 0; entity.setModel(ItemLocomotive.getModel(stack)); entity.setPrimaryColor(ItemLocomotive.getPrimaryColor(stack).ordinal()); entity.setSecondaryColor(ItemLocomotive.getSecondaryColor(stack).ordinal()); LocomotiveRenderer.INSTANCE.render(this, entity, 1.0F, 1.0F); GL11.glPopAttrib(); }
From source file:mods.railcraft.client.render.RenderBlockFrame.java
License:Open Source License
@Override public void renderItem(RenderBlocks renderBlocks, ItemStack item, ItemRenderType renderType) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_DEPTH_TEST);/*from w w w . ja v a 2 s. c o m*/ GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); BlockFrame.flipTextures = true; getBlock().setBlockBounds(1, 1, 1, 0, 0, 0); RenderTools.renderBlockOnInventory(renderBlocks, getBlock(), item.getItemDamage(), 1); BlockFrame.flipTextures = false; getBlock().setBlockBounds(0, 0, 0, 1, 1, 1); RenderTools.renderBlockOnInventory(renderBlocks, getBlock(), item.getItemDamage(), 1); GL11.glPopAttrib(); }
From source file:mods.railcraft.client.render.RenderBlockOre.java
License:Open Source License
@Override public void renderItem(RenderBlocks renderBlocks, ItemStack item, ItemRenderType renderType) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_DEPTH_TEST);/*from ww w .j a va 2s .com*/ GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); BlockOre.renderPass = 0; renderItem(renderBlocks, item, getBlock().getIcon(0, item.getItemDamage())); BlockOre.renderPass = 1; renderItem(renderBlocks, item, getBlock().getIcon(0, item.getItemDamage())); GL11.glPopAttrib(); }
From source file:mods.railcraft.client.render.RenderIronTank.java
License:Open Source License
private void preGL() { GL11.glPushMatrix();/*from w w w . j a v a2s .co m*/ GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); }
From source file:mods.railcraft.client.render.RenderSignal.java
License:Open Source License
@Override public void renderItem(RenderBlocks renderblocks, ItemStack item, ItemRenderType renderType) { float pix = RenderTools.PIXEL; float min = 6 * pix; float max = 10 * pix; GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_DEPTH_TEST);//from ww w .j ava 2s. co m GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); info.texture[0] = BlockSignalRailcraft.texturesSignalSingle[3]; info.texture[1] = BlockSignalRailcraft.texturesSignalSingle[3]; info.texture[2] = BlockSignalRailcraft.texturesSignalSingle[4]; info.texture[3] = BlockSignalRailcraft.texturesSignalSingle[4]; info.texture[4] = BlockSignalRailcraft.texturesSignalSingle[4]; info.texture[5] = BlockSignalRailcraft.texturesSignalSingle[4]; info.setBlockBounds(min, 0, min, max, 15 * pix, max); RenderFakeBlock.renderBlockOnInventory(renderblocks, info, 1); info.texture[0] = BlockSignalRailcraft.texturesSignalSingle[0]; info.texture[1] = BlockSignalRailcraft.texturesSignalSingle[0]; info.texture[2] = BlockSignalRailcraft.texturesSignalSingle[1]; info.texture[3] = BlockSignalRailcraft.texturesSignalSingle[2]; info.texture[4] = BlockSignalRailcraft.texturesSignalSingle[1]; info.texture[5] = BlockSignalRailcraft.texturesSignalSingle[1]; min = 3 * pix; max = 13 * pix; info.setBlockBounds(min, 6 * pix, min, max, 1, max); RenderFakeBlock.renderBlockOnInventory(renderblocks, info, 1); info.texture[3] = BlockSignalRailcraft.texturesLampTop[defaultAspect.getTextureIndex()]; RenderFakeBlock.renderBlockOnInventory(renderblocks, info, 1, 3); info.texture[3] = BlockSignalRailcraft.texturesSignalSingle[2]; float size = 13 * pix; info.setBlockBounds(6 * pix, 13 * pix, size, 10 * pix, 14 * pix, size + 2 * pix); RenderFakeBlock.renderBlockOnInventory(renderblocks, info, 1); info.setBlockBounds(5 * pix, 10 * pix, size, 6 * pix, 14 * pix, size + 2 * pix); RenderFakeBlock.renderBlockOnInventory(renderblocks, info, 1); info.setBlockBounds(10 * pix, 10 * pix, size, 11 * pix, 14 * pix, size + 2 * pix); RenderFakeBlock.renderBlockOnInventory(renderblocks, info, 1); GL11.glPopAttrib(); }
From source file:mods.railcraft.client.render.RenderSignalBox.java
License:Open Source License
@Override public void renderItem(RenderBlocks renderblocks, ItemStack item, ItemRenderType renderType) { GL11.glColor4f(1, 1, 1, 1);// w ww.j a v a2s. co m GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); info.override = null; float pix = RenderTools.PIXEL; info.setBlockBounds(2 * pix, 0, 2 * pix, 14 * pix, 15 * pix, 14 * pix); info.texture[0] = BlockSignalRailcraft.texturesBox[2]; info.texture[1] = iconProvider.getIcon(); info.texture[2] = BlockSignalRailcraft.texturesBox[0]; info.texture[3] = BlockSignalRailcraft.texturesBox[0]; info.texture[4] = BlockSignalRailcraft.texturesBox[0]; info.texture[5] = BlockSignalRailcraft.texturesBox[0]; RenderFakeBlock.renderBlockOnInventory(renderblocks, info, 1); int texture = SignalAspect.RED.getTextureIndex(); info.renderSide[0] = false; info.renderSide[1] = false; info.texture[2] = BlockSignalRailcraft.texturesLampBox[texture]; info.texture[3] = BlockSignalRailcraft.texturesLampBox[texture]; info.texture[4] = BlockSignalRailcraft.texturesLampBox[texture]; info.texture[5] = BlockSignalRailcraft.texturesLampBox[texture]; RenderFakeBlock.renderBlockOnInventory(renderblocks, info, 1); info.setRenderAllSides(); GL11.glPopAttrib(); }
From source file:mods.railcraft.client.render.RenderTankCartItem.java
License:Open Source License
private void renderIn3D(ItemStack stack) { GL11.glPushMatrix();/*from ww w .ja v a 2 s .c o m*/ Tessellator tessellator = Tessellator.instance; int meta = stack.getItemDamage(); for (int pass = 0; pass < stack.getItem().getRenderPasses(meta); ++pass) { IIcon icon = stack.getItem().getIconFromDamageForRenderPass(meta, pass); if (icon == null) continue; int color = stack.getItem().getColorFromItemStack(stack, pass); float c1 = (float) (color >> 16 & 255) / 255.0F; float c2 = (float) (color >> 8 & 255) / 255.0F; float c3 = (float) (color & 255) / 255.0F; if (renderItem.renderWithColor) GL11.glColor4f(c1, c2, c3, 1.0F); float minU = icon.getMinU(); float maxU = icon.getMaxU(); float minV = icon.getMinV(); float maxV = icon.getMaxV(); if (stack.getItemSpriteNumber() == 0) RenderManager.instance.renderEngine.bindTexture(BLOCK_TEXTURE); else RenderManager.instance.renderEngine.bindTexture(ITEM_TEXTURE); ItemRenderer.renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), RenderTools.PIXEL); if (stack.hasEffect(pass)) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); RenderManager.instance.renderEngine.bindTexture(GLINT_TEXTURE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f13 = 0.76F; GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); float f14 = 0.125F; GL11.glScalef(f14, f14, f14); float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F; GL11.glTranslatef(f15, 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, 255, 255, RenderTools.PIXEL); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f14, f14, f14); f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F; GL11.glTranslatef(-f15, 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, 255, 255, RenderTools.PIXEL); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } } GL11.glPopMatrix(); }
From source file:mods.railcraft.client.render.RenderTankCartItem.java
License:Open Source License
private void render(ItemRenderType type, ItemStack stack) { GL11.glPushMatrix();/*from w ww . j a v a 2s. co m*/ GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); IIcon cartTexture = stack.getIconIndex(); renderItem.renderIcon(0, 0, cartTexture, 16, 16); ItemStack filter = EntityCartTank.getFilterFromCartItem(stack); if (filter != null) { int meta = filter.getItemDamage(); float scale = 0.6f; GL11.glScalef(scale, scale, 1); GL11.glTranslatef(0, 11f, 0); if (type == ItemRenderType.ENTITY) GL11.glTranslatef(0, 0, -0.01f); for (int pass = 0; pass < filter.getItem().getRenderPasses(meta); ++pass) { IIcon bucketTexture = filter.getItem().getIconFromDamageForRenderPass(meta, pass); if (bucketTexture == null) continue; int color = filter.getItem().getColorFromItemStack(filter, pass); float c1 = (float) (color >> 16 & 255) / 255.0F; float c2 = (float) (color >> 8 & 255) / 255.0F; float c3 = (float) (color & 255) / 255.0F; if (renderItem.renderWithColor) GL11.glColor4f(c1, c2, c3, 1.0F); renderItem.renderIcon(0, 0, bucketTexture, 16, 16); } } GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:mods.railcraft.client.render.RenderTESRSignals.java
License:Open Source License
private void renderPairs(TileEntity tile, double x, double y, double z, float f, AbstractPair pair, ColorProfile colorProfile) {// w w w . j a v a2 s. c om if (pair.getPairs().isEmpty()) { return; } GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); GL11.glLineWidth(5F); GL11.glBegin(GL11.GL_LINES); for (WorldCoordinate target : pair.getPairs()) { int color = colorProfile.getColor(tile, pair.getCoords(), target); float c1 = (float) (color >> 16 & 255) / 255.0F; float c2 = (float) (color >> 8 & 255) / 255.0F; float c3 = (float) (color & 255) / 255.0F; GL11.glColor3f(c1, c2, c3); GL11.glVertex3f((float) x + 0.5f, (float) y + 0.5f, (float) z + 0.5f); float tx = (float) x + target.x - tile.xCoord; float ty = (float) y + target.y - tile.yCoord; float tz = (float) z + target.z - tile.zCoord; GL11.glVertex3f(tx + 0.5f, ty + 0.5f, tz + 0.5f); } GL11.glEnd(); GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:mss.View.java
License:Open Source License
private void initOpenGL() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadMatrix(this.buffer); GL11.glOrtho(-100, 100, -100, 100, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_BLEND);/* w w w. j a v a 2s. c o m*/ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); }