List of usage examples for org.lwjgl.opengl GL11 glRotatef
public static native void glRotatef(@NativeType("GLfloat") float angle, @NativeType("GLfloat") float x, @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);
From source file:com.dyonovan.tcnodetracker.lib.truetyper.FontHelper.java
License:Open Source License
public static void drawString(String s, float x, float y, TrueTypeFont font, float scaleX, float scaleY, float rotationZ, float... rgba) { Minecraft mc = Minecraft.getMinecraft(); ScaledResolution sr = new ScaledResolution(mc.getMinecraft(), mc.displayWidth, mc.displayHeight); if (mc.gameSettings.hideGUI) { return;/*from w w w .j ava 2s. co m*/ } int amt = 1; if (sr.getScaleFactor() == 1) { amt = 2; } FloatBuffer matrixData = BufferUtils.createFloatBuffer(16); GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, matrixData); FontHelper.set2DMode(matrixData); GL11.glPushMatrix(); y = mc.displayHeight - (y * sr.getScaleFactor()) - (((font.getLineHeight() / amt))); float tx = (x * sr.getScaleFactor()) + (font.getWidth(s) / 2); float tranx = tx + 2; float trany = y + (font.getLineHeight() / 2); GL11.glTranslatef(tranx, trany, 0); GL11.glRotatef(rotationZ, 0f, 0f, 1f); GL11.glTranslatef(-tranx, -trany, 0); GL11.glEnable(GL11.GL_BLEND); if (s.contains(formatEscape)) { String[] pars = s.split(formatEscape); float totalOffset = 0; for (int i = 0; i < pars.length; i++) { String par = pars[i]; float[] c = rgba; if (i > 0) { c = Formatter.getFormatted(par.charAt(0)); par = par.substring(1, par.length()); } font.drawString((x * sr.getScaleFactor() + totalOffset), y, par, scaleX / amt, scaleY / amt, c); totalOffset += font.getWidth(par); } } else { font.drawString((x * sr.getScaleFactor()), y, s, scaleX / amt, scaleY / amt, rgba); } GL11.glPopMatrix(); GL11.glDisable(GL11.GL_BLEND); FontHelper.set3DMode(); }
From source file:com.eagle.adventurersalchemy.render.AlchemicalFireItemRender.java
License:Open Source License
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { AlchemicalFireModel model = new AlchemicalFireModel(); GL11.glPushMatrix();//from w ww . j av a2s . co m if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) { GL11.glTranslatef(0.5F, 2.0F, 0.5F); } else if (RenderItem.renderInFrame) { GL11.glTranslatef(0.0F, 2.4F, 0.0F); } else if (type == ItemRenderType.EQUIPPED) { GL11.glTranslatef(0.5F, 1.9F, 0.5F); GL11.glEnable(GL11.GL_CULL_FACE); } else if (type == ItemRenderType.INVENTORY) { GL11.glTranslatef(0.5F, 1.7F, 0.5F); } else if (type == ItemRenderType.ENTITY) { GL11.glTranslatef(0.0F, 1.2F, 0.0F); } else { GL11.glTranslatef(0.5F, 1.2F, 0.5F); } Minecraft.getMinecraft().getTextureManager() .bindTexture(new ResourceLocation(Dictionary.TEXTURE_ALCHEMICAL_FIRE)); GL11.glPushMatrix(); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); model.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); GL11.glPopMatrix(); }
From source file:com.eagle.adventurersalchemy.render.AlchemicalFireRender.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float scale) { GL11.glPushMatrix();//from w ww. j ava2 s . c o m GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); this.bindTexture(modelTexture); GL11.glPushMatrix(); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); this.model.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); GL11.glPopMatrix(); }
From source file:com.enderville.mod.client.gui.mainmenu.MenuBaseEnderVille.java
License:LGPL
private void drawPanorama(int par1, int par2, float par3) { Tessellator tessellator = Tessellator.instance; GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix();/*from w w w. ja v a 2 s .c o m*/ GL11.glLoadIdentity(); Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDepthMask(false); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); byte b0 = 8; for (int k = 0; k < b0 * b0; ++k) { GL11.glPushMatrix(); float f1 = ((float) (k % b0) / (float) b0 - 0.5F) / 64.0F; float f2 = ((float) (k / b0) / (float) b0 - 0.5F) / 64.0F; float f3 = 0.0F; GL11.glTranslatef(f1, f2, f3); GL11.glRotatef(MathHelper.sin(((float) this.panoramaTimer + par3) / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(-((float) this.panoramaTimer + par3) * 0.1F, 0.0F, 1.0F, 0.0F); for (int l = 0; l < 6; ++l) { GL11.glPushMatrix(); if (l == 1) { GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); } if (l == 2) { GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); } if (l == 3) { GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); } if (l == 4) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); } if (l == 5) { GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); } this.mc.getTextureManager().bindTexture(titlePanoramaPaths[l]); tessellator.startDrawingQuads(); tessellator.setColorRGBA_I(16777215, 255 / (k + 1)); float f4 = 0.0F; tessellator.addVertexWithUV(-1.0D, -1.0D, 1.0D, (double) (0.0F + f4), (double) (0.0F + f4)); tessellator.addVertexWithUV(1.0D, -1.0D, 1.0D, (double) (1.0F - f4), (double) (0.0F + f4)); tessellator.addVertexWithUV(1.0D, 1.0D, 1.0D, (double) (1.0F - f4), (double) (1.0F - f4)); tessellator.addVertexWithUV(-1.0D, 1.0D, 1.0D, (double) (0.0F + f4), (double) (1.0F - f4)); tessellator.draw(); GL11.glPopMatrix(); } GL11.glPopMatrix(); GL11.glColorMask(true, true, true, false); } tessellator.setTranslation(0.0D, 0.0D, 0.0D); GL11.glColorMask(true, true, true, true); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPopMatrix(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_DEPTH_TEST); }
From source file:com.enderville.mod.client.gui.mainmenu.MenuBaseEnderVille.java
License:LGPL
/** * Draws the screen and all the components in it. *///from w w w .j a v a 2s .c om public void drawScreen(int par1, int par2, float par3) { this.renderSkybox(par1, par2, par3); Tessellator tessellator = Tessellator.instance; short short1 = 274; int k = this.width / 2 - short1 / 2; byte b0 = 30; this.drawGradientRect(0, 0, this.width, this.height, -2130706433, 16777215); this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE); this.mc.getTextureManager().bindTexture(minecraftTitleTextures); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); if ((double) this.updateCounter < 1.0E-4D) { this.drawTexturedModalRect(k + 0, b0 + 0, 0, 0, 99, 44); this.drawTexturedModalRect(k + 99, b0 + 0, 129, 0, 27, 44); this.drawTexturedModalRect(k + 99 + 26, b0 + 0, 126, 0, 3, 44); this.drawTexturedModalRect(k + 99 + 26 + 3, b0 + 0, 99, 0, 26, 44); this.drawTexturedModalRect(k + 155, b0 + 0, 0, 45, 155, 44); } else { this.drawTexturedModalRect(k + 0, b0 + 0, 0, 0, 155, 44); this.drawTexturedModalRect(k + 155, b0 + 0, 0, 45, 155, 44); } tessellator.setColorOpaque_I(16777215); GL11.glPushMatrix(); GL11.glTranslatef((float) (this.width / 2 + 90), 70.0F, 0.0F); GL11.glRotatef(-20.0F, 0.0F, 0.0F, 1.0F); float f1 = 1.8F - MathHelper .abs(MathHelper.sin((float) (Minecraft.getSystemTime() % 1000L) / 1000.0F * (float) Math.PI * 2.0F) * 0.1F); f1 = f1 * 100.0F / (float) (this.fontRenderer.getStringWidth(this.splashText) + 32); GL11.glScalef(f1, f1, f1); this.drawCenteredString(this.fontRenderer, this.splashText, 0, -8, 0x8A0868); GL11.glPopMatrix(); String s = "Minecraft 1.6.4"; this.drawString(this.fontRenderer, s, 2, this.height - (10 + 0 * (this.fontRenderer.FONT_HEIGHT + 1)), Color.YELLOW.getRGB()); if (this.mc.isDemo()) { s = s + " Demo"; } String s1 = this.getVersion(); drawString(this.fontRenderer, s1, this.width - this.fontRenderer.getStringWidth(s1) - 2, this.height - 10, 0x8A0868); if ((this.field_92025_p != null) && (this.field_92025_p.length() > 0)) { drawRect(this.field_92022_t - 2, this.field_92021_u - 2, this.field_92020_v + 2, this.field_92019_w - 1, 1428160512); drawString(this.fontRenderer, this.field_92025_p, this.field_92022_t, this.field_92021_u, 16777215); } super.drawScreen(par1, par2, par3); }
From source file:com.ethylamine.fsynthesis.client.renderer.item.TungstenChestItemRenderer.java
License:Open Source License
private void renderPlotoniumChest(ImmutableTriple<Float, Float, Float> offset) { GL11.glPushMatrix();/*from w w w.java2 s .c om*/ GL11.glScalef(SCALE.left, SCALE.middle, SCALE.right); GL11.glTranslatef(offset.left, offset.middle, offset.right); GL11.glRotatef(180.0f, 1.0f, 0.0f, 0.0f); GL11.glRotatef(90.0f, 0.0f, -1.0f, 0.0f); FMLClientHandler.instance().getClient().renderEngine.bindTexture(TungstenChestTESR.TEXTURE); vanillaChest.renderAll(); GL11.glPopMatrix(); }
From source file:com.ethylamine.fsynthesis.client.renderer.tileentity.DisintegraterTESR.java
License:Open Source License
private void renderDisintegrater(TileEntityDisintegrater te) { final int x = te.xCoord; final int y = te.yCoord; final int z = te.zCoord; final World world = te.getWorldObj(); // Lighting/* www . ja v a 2 s . c o m*/ final float brightness = ModBlocks.disintegrater.getMixedBrightnessForBlock(world, x, y, z); final int skyLight = world.getLightBrightnessForSkyBlocks(x, y, z, 0); final int skyLightLSB = skyLight % 65536; final int skyLightMSB = skyLight / 65536; Tessellator.instance.setColorOpaque_F(brightness, brightness, brightness); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, skyLightLSB, skyLightMSB); // Open Render buffer GL11.glPushMatrix(); // Inherent adjustments to model GL11.glScalef(SCALE.left, SCALE.middle, SCALE.right); GL11.glTranslatef(OFFSET.left, OFFSET.middle, OFFSET.right); // Orient the model to match the placement final int metadata = world.getBlockMetadata(x, y, z); final Orientation orientation = Orientation.getdecodedOrientation(metadata); GL11.glRotatef(getAngleFromOrientation(orientation), 0.0F, 1.0F, 0.0F); // Bind the texture bindTexture(TEXTURE); // Render model.render(); // Close Render Buffer GL11.glPopMatrix(); }
From source file:com.ethylamine.fsynthesis.client.renderer.tileentity.TungstenChestTESR.java
License:Open Source License
private void renderTungstenChest(TungstenChestTE te, float tick) { final int x = te.xCoord; final int y = te.yCoord; final int z = te.zCoord; final World world = te.getWorldObj(); GL11.glPushMatrix();/*w w w .j a va 2 s . c om*/ // Position Renderer bindTexture(TEXTURE); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(1.0F, -1.0F, -1.0F); //flip & rotate GL11.glTranslatef(0.5F, 0.5F, 0.5F); //translate block pos around fromBLK ORG final int metadata = world.getBlockMetadata(x, y, z); final Orientation orientation = Orientation.getdecodedOrientation(metadata); GL11.glRotatef(getAngleFromOrientation(orientation), 0.0F, -1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); //translate BLK ORG to block pos //lid angle. float adjLDAngle = te.getPrevLidAngle() + (te.getLidAngle() - te.getPrevLidAngle()) * tick; adjLDAngle = 1.0F - adjLDAngle; adjLDAngle = 1.0F - adjLDAngle * adjLDAngle * adjLDAngle; //noinspection NumericCastThatLosesPrecision vanillaChest.chestLid.rotateAngleX = -(adjLDAngle * (float) Math.PI / 2.0F); vanillaChest.renderAll(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:com.fr3gu.letsmod.client.RenderSpaceship.java
License:LGPL
public void renderSpaceship(EntitySpaceship spaceship, double x, double y, double z, float yaw, float partialTickTime) { GL11.glPushMatrix();/* w w w . j ava2 s . co m*/ GL11.glTranslatef((float) x, (float) y, (float) z); GL11.glRotatef(180.0F - yaw, 0.0F, 1.0F, 0.0F); GL11.glScaled(-1.0F, -1.0F, 1.0F); func_110777_b(spaceship); model.render(spaceship, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); }
From source file:com.freyja.FES.client.models.ModelInjector.java
License:LGPL
public void render(RoutingEntity te, double x, double y, double z) { GL11.glPushMatrix();/*from ww w . jav a 2 s . c om*/ GL11.glTranslatef((float) x + 0.5f, (float) y, (float) z + 0.5f); ForgeDirection orientation = te.getOrientation(); if (orientation == ForgeDirection.DOWN) { GL11.glRotatef(180, 1, 0, 0); GL11.glTranslatef(0, -1f, 0f); } if (orientation == ForgeDirection.SOUTH) { GL11.glRotatef(90, 1, 0, 0); GL11.glTranslatef(0, -.5f, -.5f); } if (orientation == ForgeDirection.NORTH) { GL11.glRotatef(90, -1, 0, 0); GL11.glTranslatef(0, -.5f, .5f); } if (orientation == ForgeDirection.WEST) { GL11.glRotatef(90, 0, 0, 1); GL11.glTranslatef(.5f, -.5f, 0); } if (orientation == ForgeDirection.EAST) { GL11.glRotatef(90, 0, 0, -1); GL11.glTranslatef(-.5f, -.5f, 0); } GL11.glScalef(0.5f, 0.5f, 0.5f); FMLClientHandler.instance(). getClient() .renderEngine.bindTexture("/mods/FES/textures/injector.png"); this. render(); GL11.glPopMatrix(); }