List of usage examples for org.lwjgl.opengl GL11 glPushMatrix
public static native void glPushMatrix();
From source file:com.bluepowermod.client.render.RenderEngine.java
License:Open Source License
@SuppressWarnings("cast") @Override/*from w ww .j a v a 2 s . c o m*/ public void renderTileEntityAt(TileEntity engine, double x, double y, double z, float f) { if (engine instanceof TileEngine) { GL11.glPushMatrix(); GL11.glDisable(GL11.GL_LIGHTING); TileEngine tile = (TileEngine) engine.getWorldObj().getTileEntity(engine.xCoord, engine.yCoord, engine.zCoord); ForgeDirection direction = tile.getOrientation(); GL11.glTranslated(x, y, z); GL11.glScaled(.0315, .0315, .0315); if (direction == ForgeDirection.UP) { GL11.glTranslated(16, 28, 16); GL11.glRotatef(180, 1, 0, 0); } if (direction == ForgeDirection.DOWN) { GL11.glTranslated(16, 4, 16); GL11.glRotatef(0, 0, 0, 0); } if (direction == ForgeDirection.EAST) { GL11.glTranslated(28, 16, 16); GL11.glRotatef(90, 0, 0, 1); } if (direction == ForgeDirection.WEST) { GL11.glTranslated(4, 16, 16); GL11.glRotatef(90, 0, 0, -1); } if (direction == ForgeDirection.NORTH) { GL11.glTranslated(16, 16, 4); GL11.glRotatef(90, 1, 0, 0); } if (direction == ForgeDirection.SOUTH) { GL11.glTranslated(16, 16, 28); GL11.glRotatef(90, -1, 0, 0); } if (tile.isActive) { bindTexture(textureLocationOn); } else { bindTexture(textureLocationOff); } engineModel.renderAllExcept("gear", "glider"); if (tile.isActive) { f += tile.pumpTick; if (tile.pumpSpeed > 0) { f /= tile.pumpSpeed; } } else { f = 0; } f = (float) ((float) 6 * (.5 - .5 * Math.cos(3.1415926535897931D * (double) f))); GL11.glTranslatef(0, f, 0); engineModel.renderPart("glider"); GL11.glTranslatef(0, -f, 0); if (tile.isActive) { if (tile.getWorldObj().isRemote) { rotateAmount++; GL11.glRotated(tile.gearTick * 19, 0, 1.5707963267948966D * (double) f, 0); } } engineModel.renderPart("gear"); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); } }
From source file:com.bluepowermod.client.render.RenderHelper.java
License:Open Source License
public static void renderRedstoneTorch(double x, double y, double z, double height, boolean state, boolean digital) { GL11.glPushMatrix(); {//w w w.ja v a 2s.c om Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); if (digital) { rb.overrideBlockTexture = state ? IconSupplier.bluestoneTorchOn : IconSupplier.bluestoneTorchOff; } else { rb.overrideBlockTexture = state ? Blocks.redstone_torch.getIcon(0, 0) : Blocks.unlit_redstone_torch.getIcon(0, 0); } GL11.glEnable(GL11.GL_CLIP_PLANE0); GL11.glClipPlane(GL11.GL_CLIP_PLANE0, uk.co.qmunity.lib.client.render.RenderUtils.planeEquation(0, 1, 0)); GL11.glTranslated(x, y + height - 1, z); Tessellator t = Tessellator.instance; t.setColorOpaque_F(1.0F, 1.0F, 1.0F); t.startDrawingQuads(); { rb.setRenderBounds(7 / 16D, 0, 0, 9 / 16D, 1, 1); t.setNormal(-1, 1, 0); rb.renderFaceXNeg(Blocks.stone, 0, 0, 0, null); t.setNormal(1, 1, 0); rb.renderFaceXPos(Blocks.stone, 0, 0, 0, null); rb.setRenderBounds(0, 0, 7 / 16D, 1, 1, 9 / 16D); t.setNormal(0, 1, -1); rb.renderFaceZNeg(Blocks.stone, 0, 0, 0, null); t.setNormal(0, 1, 1); rb.renderFaceZPos(Blocks.stone, 0, 0, 0, null); rb.setRenderBounds(7 / 16D, 0, 6 / 16D, 9 / 16D, 10 / 16D, 8 / 16D); t.setNormal(0, 1, 0); rb.renderFaceYPos(Blocks.stone, 0, 0, 1 / 16D, null); } t.draw(); GL11.glDisable(GL11.GL_CLIP_PLANE0); rb.overrideBlockTexture = null; } GL11.glPopMatrix(); }
From source file:com.bluepowermod.client.render.RenderHelper.java
License:Open Source License
public static void renderButton(double x, double y, double z, String res, String resSide) { GL11.glPushMatrix(); {//from w ww.ja v a 2s . co m GL11.glTranslated(x, y, z); GL11.glPushMatrix(); { GL11.glTranslated(6 / 16D, 2 / 16D, 8 / 16D); Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(resSide)); for (int i = 0; i < 4; i++) { GL11.glTranslated(2 / 16D, 0, 2 / 16D); GL11.glRotated(90, 0, 1, 0); GL11.glTranslated(-2 / 16D, 0, -2 / 16D); GL11.glBegin(GL11.GL_QUADS); { GL11.glNormal3d(1, 0, 0); addVertexWithTexture(0, 0, 0, 0, 0); addVertexWithTexture(0, 1 / 16D, 0, 0, 1); addVertexWithTexture(4 / 16D, 1 / 16D, 0, 1, 1); addVertexWithTexture(4 / 16D, 0, 0, 1, 0); } GL11.glEnd(); } } GL11.glPopMatrix(); GL11.glTranslated(0, 1 / 16D, 0 / 16D); Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(res)); Tessellator t = Tessellator.instance; y = 2 / 16D; t.startDrawingQuads(); t.setNormal(0, 1, 0); { t.addVertexWithUV(0, y, 0, 1, 1); t.addVertexWithUV(0, y, 1, 1, 0); t.addVertexWithUV(1, y, 1, 0, 0); t.addVertexWithUV(1, y, 0, 0, 1); } t.draw(); } GL11.glPopMatrix(); }
From source file:com.bluepowermod.client.render.RenderHelper.java
License:Open Source License
/** * @author amadornes/*from w w w .j a v a 2s . c o m*/ * @param x * @param y * @param z * @param angle */ public static void renderPointer(double x, double y, double z, double angle) { GL11.glPushMatrix(); { GL11.glTranslated(x, y, z); GL11.glTranslated(0.5, 0.5, 0.5); GL11.glRotated(180 + 360 * -angle, 0, 1, 0); GL11.glTranslated(-0.5, -0.5, -0.5); Minecraft.getMinecraft().renderEngine .bindTexture(new ResourceLocation("minecraft:textures/blocks/stone.png")); GL11.glBegin(GL11.GL_QUADS); { GL11.glNormal3d(0, -1, 0); // Bottom addVertexWithTexture(0.5, 0, 2D / 16D, 0.5, 1D / 16D); addVertexWithTexture(0.5 + 1D / 8D, 0, 0.5, 0.5 + 1D / 8D, 0.5); addVertexWithTexture(0.5, 0, 0.5 + 1D / 8D, 0.5, 0.5 + 1D / 8D); addVertexWithTexture(0.5 - 1D / 8D, 0, 0.5, 0.5 - 1D / 8D, 0.5); GL11.glNormal3d(0, 1, 0); // Top addVertexWithTexture(0.5, 1D / 16D, 2D / 16D, 0.5, 1D / 16D); addVertexWithTexture(0.5 - 1D / 8D, 1D / 16D, 0.5, 0.5 - 1D / 8D, 0.5); addVertexWithTexture(0.5, 1D / 16D, 0.5 + 1D / 8D, 0.5, 0.5 + 1D / 8D); addVertexWithTexture(0.5 + 1D / 8D, 1D / 16D, 0.5, 0.5 + 1D / 8D, 0.5); GL11.glNormal3d(1, 0, 0); // Side 1 addVertexWithTexture(0.5, 1D / 16D, 2D / 16D, 0.5, 1D / 16D); addVertexWithTexture(0.5, 0, 2D / 16D, 0.5, 1D / 16D); addVertexWithTexture(0.5 - 1D / 8D, 0, 0.5, 0.5 - 1D / 8D, 0.5); addVertexWithTexture(0.5 - 1D / 8D, 1D / 16D, 0.5, 0.5 - 1D / 8D, 0.5); // Side 2 addVertexWithTexture(0.5 - 1D / 8D, 1D / 16D, 0.5, 0.5 - 1D / 8D, 0.5); addVertexWithTexture(0.5 - 1D / 8D, 0, 0.5, 0.5 - 1D / 8D, 0.5); addVertexWithTexture(0.5, 0, 0.5 + 1D / 8D, 0.5, 0.5 + 1D / 8D); addVertexWithTexture(0.5, 1D / 16D, 0.5 + 1D / 8D, 0.5, 0.5 + 1D / 8D); GL11.glNormal3d(-1, 0, 0); // Side 3 addVertexWithTexture(0.5, 1D / 16D, 0.5 + 1D / 8D, 0.5, 0.5 + 1D / 8D); addVertexWithTexture(0.5, 0, 0.5 + 1D / 8D, 0.5, 0.5 + 1D / 8D); addVertexWithTexture(0.5 + 1D / 8D, 0, 0.5, 0.5 + 1D / 8D, 0.5); addVertexWithTexture(0.5 + 1D / 8D, 1D / 16D, 0.5, 0.5 + 1D / 8D, 0.5); // Side 4 addVertexWithTexture(0.5 + 1D / 8D, 1D / 16D, 0.5, 0.5 + 1D / 8D, 0.5); addVertexWithTexture(0.5 + 1D / 8D, 0, 0.5, 0.5 + 1D / 8D, 0.5); addVertexWithTexture(0.5, 0, 2D / 16D, 0.5, 1D / 16D); addVertexWithTexture(0.5, 1D / 16D, 2D / 16D, 0.5, 1D / 16D); } GL11.glEnd(); } GL11.glPopMatrix(); }
From source file:com.bluepowermod.client.render.RenderItemEngine.java
License:Open Source License
private void renderEngine(float x, float y, float z, float rotateAmount, float rotatex, float rotatey, float rotatez) { GL11.glPushMatrix(); GL11.glDisable(GL11.GL_LIGHTING);//from w w w. j av a 2 s. c om GL11.glScalef(.034F, .034F, .034F); GL11.glTranslated(x, y, z); GL11.glRotatef(rotateAmount, rotatex, rotatey, rotatez); FMLClientHandler.instance().getClient().renderEngine.bindTexture(textureLocation); model.renderAll(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:com.bluepowermod.client.render.RenderLamp.java
License:Open Source License
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glPushMatrix(); {/* w ww . j ava2 s . c o m*/ switch (type) { case ENTITY: GL11.glTranslated(-0.5, -0.5, -0.5); break; case EQUIPPED: break; case EQUIPPED_FIRST_PERSON: GL11.glTranslated(0, -0.1, 0); break; case INVENTORY: GL11.glTranslated(0, -0.1, 0); break; default: break; } BlockLamp block = (BlockLamp) Block.getBlockFromItem(item.getItem()); int redMask = 0xFF0000, greenMask = 0xFF00, blueMask = 0xFF; int r = (block.getColor() & redMask) >> 16; int g = (block.getColor() & greenMask) >> 8; int b = (block.getColor() & blueMask); Vec3dCube cube = new Vec3dCube(0.0, 0.0, 0.0, 1.0, 1.0, 1.0); Tessellator t = Tessellator.instance; t.startDrawingQuads(); t.setColorOpaque(r, g, b); RenderHelper h = RenderHelper.instance; h.reset(); h.setColor(block.getColor()); h.renderBox(cube, block.isInverted() ? BlockLamp.on : BlockLamp.off); h.reset(); t.draw(); if (block.isInverted()) { GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); // GL11.glAlphaFunc(GL11.GL_EQUAL, (power / 15F) * 1F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); // GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDepthMask(false); GL11.glBegin(GL11.GL_QUADS); com.bluepowermod.client.render.RenderHelper.drawColoredCube(cube.clone().expand(0.8 / 16D), r / 256D, g / 256D, b / 256D, 0.625D); GL11.glEnd(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glDisable(GL11.GL_BLEND); } } GL11.glPopMatrix(); }
From source file:com.bluepowermod.client.render.RenderPartItem.java
License:Open Source License
private void render(float x, float y, float z, float scale, ItemRenderType type, ItemStack item, Object... data) {// w w w.jav a 2 s .c om boolean blend = GL11.glGetBoolean(GL11.GL_BLEND); boolean alpha = GL11.glGetBoolean(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glPushMatrix(); GL11.glScalef(scale, scale, scale); GL11.glTranslatef(x, y, z); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); try { BPPart part = PartManager.getExample(item); part.renderItem(type, item, data); } catch (Exception ex) { } GL11.glPopMatrix(); if (!blend) GL11.glDisable(GL11.GL_BLEND); if (!alpha) GL11.glDisable(GL11.GL_ALPHA_TEST); }
From source file:com.bluepowermod.client.render.RenderWindmill.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float var8) { TileWindmill mill = (TileWindmill) tile.getWorldObj().getTileEntity(tile.xCoord, tile.yCoord, tile.zCoord); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_LIGHTING);// www .j av a 2s.c om GL11.glTranslated(x + .5, y, z + .5); GL11.glScaled(.15, .15, .15); this.bindTexture(textureLocation); GL11.glRotated(mill.turbineTick, 0, 1, 0); model.renderAll(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:com.bluepowermod.part.gate.GateCounter.java
License:Open Source License
@Override @SideOnly(Side.CLIENT)/*from ww w .j av a2s . c om*/ public void renderTop(float frame) { renderTop("left", left().getInput() > 0); renderTop("right", right().getInput() > 0); renderTop("centerleft", left().getInput() > 0); RenderHelper.renderDigitalRedstoneTorch(-2 / 16D, 2D / 8D, 0, 13D / 16D, true); RenderHelper.renderDigitalRedstoneTorch(0, 2D / 8D, -5D / 16D, 8D / 16D, count == 0); RenderHelper.renderDigitalRedstoneTorch(0, 2D / 8D, 5D / 16D, 8D / 16D, count == max); GL11.glPushMatrix(); { GL11.glTranslated(2 / 16D, 0, 0); double min = 0.555; double max = 0.385; double angle = min + max * (count / (double) this.max); RenderHelper.renderPointer(-4 / 16D, 7 / 16D, 0, -angle + 0.5); } GL11.glPopMatrix(); }
From source file:com.bluepowermod.part.gate.GateRSLatch.java
License:Open Source License
@Override @SideOnly(Side.CLIENT)/*from w w w. java 2 s.c om*/ public void renderTop(float frame) { if (mode % 2 == 1) { GL11.glPushMatrix(); GL11.glTranslated(0.5, 0, 0.5); GL11.glScaled(-1, 1, 1); GL11.glTranslated(-0.5, 0, -0.5); GL11.glDisable(GL11.GL_CULL_FACE); } Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation( Refs.MODID + ":textures/blocks/gates/" + getTextureName() + (mode > 1 ? "2" : "") + "/base.png")); this.renderTop(); Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(Refs.MODID + ":textures/blocks/gates/" + getTextureName() + (mode > 1 ? "2" : "") + "/left_" + ((mode % 2 == 0 ? left().getInput() > 0 : right().getInput() > 0) ? "on" : "off") + ".png")); renderTop(); Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(Refs.MODID + ":textures/blocks/gates/" + getTextureName() + (mode > 1 ? "2" : "") + "/right_" + ((mode % 2 == 0 ? right().getInput() > 0 : left().getInput() > 0) ? "on" : "off") + ".png")); renderTop(); if (mode > 1) { Minecraft.getMinecraft().renderEngine .bindTexture(new ResourceLocation(Refs.MODID + ":textures/blocks/gates/" + getTextureName() + "2/front" + "_" + (front().getInput() > 0 ? "on" : "off") + ".png")); renderTop(); Minecraft.getMinecraft().renderEngine .bindTexture(new ResourceLocation(Refs.MODID + ":textures/blocks/gates/" + getTextureName() + "2/back" + "_" + (back().getInput() > 0 ? "on" : "off") + ".png")); renderTop(); } RenderHelper.renderDigitalRedstoneTorch(1D / 8D, 3D / 16D, -2D / 8D, 9D / 16D, front().getInput() == 0); RenderHelper.renderDigitalRedstoneTorch(-1D / 8D, 3D / 16D, 2D / 8D, 9D / 16D, back().getInput() == 0); if (mode % 2 == 1) { GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); } }