List of usage examples for org.lwjgl.opengl GL11 glPopMatrix
public static native void glPopMatrix();
From source file:com.builtbroken.grappling.content.item.ItemHookRenderer.java
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glPushMatrix();//www .ja v a 2 s . c o m FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE); Entity entity = null; if (data != null && data.length >= 2 && data[1] instanceof Entity) { entity = (Entity) data[1]; } if (type == ItemRenderType.EQUIPPED) { //TODO have rotation match aiming point GL11.glRotatef(-130, 0, 1, 0); //GL11.glRotatef(13, 1, 0, 0); GL11.glTranslatef(0.1f, 0.4f, -1.2f); final float scale = 0.0625f / 3; GL11.glScalef(scale, scale, scale); if (entity != null && entity == Minecraft.getMinecraft().thePlayer) { if (ClientHookHandler.hook != null) { MODEL.renderAllExcept("group5", "Component_20"); } else { MODEL.renderAll(); } } else { MODEL.renderAll(); } } else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) { GL11.glRotatef(140, 0, 1, 0); GL11.glRotatef(-13, 1, 0, 0); GL11.glTranslatef(-0.2f, 0.6f, -0.5f); final float scale = 0.0625f / 3; GL11.glScalef(scale, scale, scale); if (ClientHookHandler.hook != null) { MODEL.renderAllExcept("group5", "Component_20"); } else { MODEL.renderAll(); } } else if (type == ItemRenderType.ENTITY) { GL11.glTranslatef(0f, 0, -0.9f); final float scale = 0.0625f / 3; GL11.glScalef(scale, scale, scale); MODEL.renderAll(); } GL11.glPopMatrix(); }
From source file:com.builtbroken.icbm.content.ams.TileAMSClient.java
@SideOnly(Side.CLIENT) public void renderDynamic(Pos pos, float deltaTime, int pass) { //Lerp rotation values so not to have snapping effects(looks bad) if (!currentAim.isWithin(aim, 1)) { currentAim.moveTowards(aim, ROTATION_SPEED, deltaTime).clampTo360(); }/*from w w w. j a va 2 s.c o m*/ lastRotationUpdate = System.nanoTime(); GL11.glPushMatrix(); GL11.glTranslatef(pos.xf() + 0.5f, pos.yf(), pos.zf() + 0.5f); GL11.glRotatef((float) ((currentAim.yaw() + 90f) % 360), 0, 1, 0); FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.AMS_TEXTURE); Assets.AMS_BOTTOM_MODEL.renderAll(); GL11.glTranslatef(0, 0.5f, 0); GL11.glRotatef((float) currentAim.pitch(), 0, 0, 1); Assets.AMS_TOP_MODEL.renderAll(); GL11.glPopMatrix(); }
From source file:com.builtbroken.icbm.content.crafting.station.small.auto.TileSMAutoCraftClient.java
@Override @SideOnly(Side.CLIENT)/*from w w w. j a va 2s. com*/ public void renderDynamic(Pos pos, float frame, int pass) { //Render launcher GL11.glPushMatrix(); GL11.glTranslatef(pos.xf() + 0.5f, pos.yf(), pos.zf() + 0.5f); GL11.glRotated(90, 0, 1, 0); FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.SMALL_WORKSTATION_TEXTURE2); if (getDirection() == ForgeDirection.EAST) { GL11.glRotated(-90, 0, 1, 0); } else if (getDirection() == ForgeDirection.WEST) { GL11.glRotated(90, 0, 1, 0); } else if (getDirection() == ForgeDirection.SOUTH) { GL11.glRotated(180, 0, 1, 0); } Assets.CART1x3.renderAll(); GL11.glPopMatrix(); //render missile if (completedMissile != null) { GL11.glPushMatrix(); TileSmallMissileWorkstationClient.renderMissile(pos, completedMissile, ForgeDirection.UP, getDirection()); GL11.glPopMatrix(); } else if (startedMissile != null) { GL11.glPushMatrix(); TileSmallMissileWorkstationClient.renderMissile(pos, startedMissile, ForgeDirection.UP, getDirection()); GL11.glPopMatrix(); } }
From source file:com.builtbroken.icbm.content.crafting.station.small.TileSmallMissileWorkstationClient.java
@SideOnly(Side.CLIENT) public static void renderDynamic(Pos pos, Pos offset, ForgeDirection connectedBlockSide, ForgeDirection direction, IMissile missile, float frame, int pass) { //Render launcher GL11.glPushMatrix();//from w w w . ja va 2s . c o m GL11.glTranslatef(pos.xf() + offset.xf(), pos.yf() + offset.yf(), pos.zf() + offset.zf()); GL11.glRotated(90, 0, 1, 0); FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.SMALL_WORKSTATION_TEXTURE2); int tableX = 2; //Keep in mind the directions are of the facing block switch (connectedBlockSide) { case UP: if (direction == ForgeDirection.EAST) { GL11.glRotated(-90, 0, 1, 0); //x y z GL11.glTranslatef(-2, 0f, -1); } else if (direction == ForgeDirection.WEST) { GL11.glRotated(90, 0, 1, 0); //x y z GL11.glTranslatef(-1, 0f, 2); } else if (direction == ForgeDirection.SOUTH) { GL11.glRotated(180, 0, 1, 0); //x y z GL11.glTranslatef(-3, 0f, 1); } break; case DOWN: GL11.glRotated(180, 1, 0, 0); // z y x GL11.glTranslatef(0f, -1f, 1f); if (direction == ForgeDirection.WEST) { GL11.glRotated(-90, 0, 1, 0); //x y z GL11.glTranslatef(-2f, 0f, -1f); } else if (direction == ForgeDirection.EAST) { GL11.glRotated(90, 0, 1, 0); //x y z GL11.glTranslatef(-1f, 0f, 2f); } else if (direction == ForgeDirection.SOUTH) { GL11.glRotated(180, 0, 1, 0); //x y z GL11.glTranslatef(-3, 0f, 1); } break; case EAST: GL11.glRotated(90, 1, 0, 0); // z x y GL11.glTranslatef(0f, -1f, 0f); if (direction == ForgeDirection.DOWN) { GL11.glRotated(-90, 0, 1, 0); // y x z GL11.glTranslatef(-2f, 0f, -1f); } else if (direction == ForgeDirection.UP) { GL11.glRotated(90, 0, 1, 0); // y x z GL11.glTranslatef(-1f, 0f, 2f); } if (direction == ForgeDirection.SOUTH) { GL11.glRotated(180, 0, 1, 0); // y x z GL11.glTranslatef(-3f, 0f, 1f); } break; case WEST: GL11.glRotated(-90, 1, 0, 0); // z x y if (direction == ForgeDirection.UP) { GL11.glRotated(-90, 0, 1, 0); // y x z GL11.glTranslatef(-1f, 0f, -1f); } else if (direction == ForgeDirection.DOWN) { GL11.glRotated(90, 0, 1, 0); // y x z GL11.glTranslatef(-2f, 0f, 2f); } else { GL11.glTranslatef(0f, 0f, 1f); if (direction == ForgeDirection.SOUTH) { GL11.glRotated(180, 0, 1, 0); // y x z GL11.glTranslatef(-3f, 0f, 1f); } } break; case NORTH: GL11.glRotated(90, 0, 1, 0); GL11.glRotated(90, 1, 0, 0); // y x z GL11.glTranslatef(-1f, 1f, 0f); if (direction == ForgeDirection.DOWN) { GL11.glRotated(-90, 0, 1, 0); // y z x GL11.glTranslatef(-2f, 0f, -1f); } else if (direction == ForgeDirection.EAST) { GL11.glRotated(180, 0, 1, 0); GL11.glTranslatef(-3f, 0f, 1f); } else if (direction == ForgeDirection.UP) { GL11.glRotated(90, 0, 1, 0); // y z x GL11.glTranslatef(-1f, 0f, 2f); } break; case SOUTH: GL11.glRotated(90, 0, 1, 0); GL11.glRotated(-90, 1, 0, 0); // x z y GL11.glTranslatef(-1f, -2f, 1f); if (direction == ForgeDirection.UP) { GL11.glRotated(-90, 0, 1, 0); // y z x GL11.glTranslatef(-2f, 0f, -1f); } else if (direction == ForgeDirection.EAST) { GL11.glRotated(180, 0, 1, 0); // x z y GL11.glTranslatef(-3f, 0, 1f); } else if (direction == ForgeDirection.DOWN) { GL11.glRotated(90, 0, 1, 0); // y z x GL11.glTranslatef(-1f, 0f, 2f); } break; } Assets.SMALL_MISSILE_STATION_MODEL2.renderAll(); GL11.glTranslatef(tableX, 0, 0); FMLClientHandler.instance().getClient().renderEngine.bindTexture(SharedAssets.TOOL_TABLE_TEXTURE); SharedAssets.TOOL_TABLE.renderAll(); GL11.glPopMatrix(); //render missile if (missile != null) { GL11.glPushMatrix(); renderMissile(pos, missile, connectedBlockSide, direction); GL11.glPopMatrix(); } }
From source file:com.builtbroken.icbm.content.crafting.station.warhead.TileWarheadStationClient.java
@Override @SideOnly(Side.CLIENT)//from w ww . ja v a 2 s .c om public void renderDynamic(Pos pos, float frame, int pass) { GL11.glPushMatrix(); GL11.glTranslatef(pos.xf() + 1, pos.yf(), pos.zf() + 1); GL11.glRotated(90, 0, 1, 0); FMLClientHandler.instance().getClient().renderEngine.bindTexture(SharedAssets.TOOL_TABLE_TEXTURE); SharedAssets.TOOL_TABLE.renderAll(); //TODO render warhead on table, remove some tools GL11.glPopMatrix(); //TODO render warhead //TODO render explosives }
From source file:com.builtbroken.icbm.content.fof.TileFoFClient.java
@Override public void renderDynamic(Pos pos, float frame, int pass) { //Render launcher GL11.glPushMatrix();/* w w w.j a v a 2 s . c o m*/ GL11.glTranslatef(pos.xf() + 0.5f, pos.yf() + 0.5f, pos.zf() + 0.5f); switch (getDirection()) { case EAST: break; case WEST: GL11.glRotatef(180f, 0, 1f, 0); break; case SOUTH: GL11.glRotatef(-90f, 0, 1f, 0); break; default: GL11.glRotatef(90f, 0, 1f, 0); break; } FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.FoF_STATION_TEXTURE); Assets.FoF_STATION_MODEL.renderAll(); GL11.glPopMatrix(); }
From source file:com.builtbroken.icbm.content.fragments.RenderFragment.java
public void doRender(EntityFragment entity, double xx, double yy, double zz, float p_76986_8_, float p_76986_9_) { FragmentType type = entity.fragmentType; if (type == FragmentType.BLOCK) { GL11.glPushMatrix();/*ww w. j a va2 s . c om*/ GL11.glTranslated(xx, yy, zz); RenderUtility.renderCube(entity.renderShape.toAABB(), entity.fragmentMaterial == null ? Blocks.stone : entity.fragmentMaterial); GL11.glPopMatrix(); } else if (type == FragmentType.BLAZE) { doRenderFireBall(entity, xx, yy, zz, p_76986_8_, p_76986_9_, 0.3f); } else { this.bindEntityTexture(entity); doRenderArrow(entity, xx, yy, zz, p_76986_8_, p_76986_9_); } }
From source file:com.builtbroken.icbm.content.fragments.RenderFragment.java
public void doRenderFireBall(EntityFragment entity, double xx, double yy, double zz, float p_76986_8_, float p_76986_9_, float scale) { GL11.glPushMatrix();//from ww w .j a v a 2s.c om this.renderManager.renderEngine.bindTexture(TextureMap.locationItemsTexture); GL11.glTranslatef((float) xx, (float) yy, (float) zz); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(scale / 1.0F, scale / 1.0F, scale / 1.0F); IIcon iicon = Items.fire_charge.getIconFromDamage(0); Tessellator tessellator = Tessellator.instance; float minU = iicon.getMinU(); float maxU = iicon.getMaxU(); float minV = iicon.getMinV(); float maxV = iicon.getMaxV(); float f7 = 1.0F; float f8 = 0.5F; float f9 = 0.25F; GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F, 0.0F); tessellator.addVertexWithUV((double) (0.0F - f8), (double) (0.0F - f9), 0.0D, (double) minU, (double) maxV); tessellator.addVertexWithUV((double) (f7 - f8), (double) (0.0F - f9), 0.0D, (double) maxU, (double) maxV); tessellator.addVertexWithUV((double) (f7 - f8), (double) (1.0F - f9), 0.0D, (double) maxU, (double) minV); tessellator.addVertexWithUV((double) (0.0F - f8), (double) (1.0F - f9), 0.0D, (double) minU, (double) minV); tessellator.draw(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:com.builtbroken.icbm.content.fragments.RenderFragment.java
private void doRenderArrow(EntityFragment entity, double xx, double yy, double zz, float p_76986_8_, float p_76986_9_) { GL11.glPushMatrix();//from ww w . ja v a 2 s . co m GL11.glTranslatef((float) xx, (float) yy, (float) zz); GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_76986_9_ - 90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_76986_9_, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.instance; byte b0 = 0; float f2 = 0.0F; float f3 = 0.5F; float f4 = (float) (0 + b0 * 10) / 32.0F; float f5 = (float) (5 + b0 * 10) / 32.0F; float f6 = 0.0F; float f7 = 0.15625F; float f8 = (float) (5 + b0 * 10) / 32.0F; float f9 = (float) (10 + b0 * 10) / 32.0F; float f10 = 0.05625F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); GL11.glScalef(f10, f10, f10); GL11.glTranslatef(-4.0F, 0.0F, 0.0F); GL11.glNormal3f(f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f9); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f9); tessellator.draw(); GL11.glNormal3f(-f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f9); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f9); tessellator.draw(); for (int i = 0; i < 4; ++i) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f10); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) f2, (double) f4); tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) f3, (double) f4); tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double) f3, (double) f5); tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double) f2, (double) f5); tessellator.draw(); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:com.builtbroken.icbm.content.launcher.block.TileLauncherFrame.java
@Override public void renderInventoryItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data) { GL11.glPushMatrix();//w w w. j a v a 2 s.c o m GL11.glScalef(1f, 1f, 1f); GL11.glTranslatef(-0.0F, -0.5F, 0.0F); FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.LAUNCHER_FRAME_TEXTURE); Assets.LAUNCHER_FRAME_BLOCK_MODEL.renderAll(); GL11.glPopMatrix(); }