List of usage examples for org.lwjgl.opengl GL11 glTranslatef
public static native void glTranslatef(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);
From source file:com.dbi.games.fortress.engine.graphics.Sprite.java
public void draw(int x, int y) { if (tex == null) return;//from w ww . ja v a2 s.co m GL11.glPushMatrix(); tex.bind(); GL11.glTranslatef(x, y, 0); GL11.glBegin(GL11.GL_QUADS); { GL11.glTexCoord2f(0, 0); GL11.glVertex2f(0, 0); GL11.glTexCoord2f(0, 1f); GL11.glVertex2f(0, getHeight()); GL11.glTexCoord2f(1f, 1f); GL11.glVertex2f(getWidth(), getHeight()); GL11.glTexCoord2f(1f, 0); GL11.glVertex2f(getWidth(), 0); } GL11.glEnd(); GL11.glPopMatrix(); }
From source file:com.domsplace.FaultEngine.Location.Location3D.java
License:Apache License
public void applyTranslations(boolean invertCoords, boolean invertRotations) { float x = this.getFloatX(); float y = this.getFloatY(); float z = this.getFloatZ(); float p = (float) this.pitch; float ya = (float) this.yaw; float r = (float) this.getRotation(); if (invertCoords) { x = -x;/*w ww . jav a2s.co m*/ y = -y; z = -z; } if (invertRotations) { p = -p; ya = -ya; r = -r; } GL11.glTranslatef(x, y, z); GL11.glRotatef(p, 1, 0, 0); GL11.glRotatef(ya, 0, 1, 0); GL11.glRotatef(r, 0, 0, 1); }
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;/*ww w .j a va2 s . 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.dyonovan.tcnodetracker.lib.truetyper.FontHelper.java
License:Open Source License
private static void set2DMode(FloatBuffer matrixData) { Minecraft mc = Minecraft.getMinecraft(); ScaledResolution sr = new ScaledResolution(mc.getMinecraft(), mc.displayWidth, mc.displayHeight); mc.entityRenderer.setupOverlayRendering(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix();//from w w w.j a v a 2s . co m //GL11.glLoadMatrix(matrixData); GL11.glLoadIdentity(); GL11.glOrtho(0, mc.displayWidth, 0, mc.displayHeight, -1, 1); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); Matrix4f matrix = new Matrix4f(); matrix.load(matrixData); GL11.glTranslatef(matrix.m30 * sr.getScaleFactor(), -matrix.m31 * sr.getScaleFactor(), 0f); }
From source file:com.eagle.adventurersalchemy.model.AlchemicalFireModel.java
License:Open Source License
@Override public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { GL11.glPushMatrix();/*from www . j a va2 s . c o m*/ GL11.glTranslatef(this.frontBorder.offsetX, this.frontBorder.offsetY, this.frontBorder.offsetZ); GL11.glTranslatef(this.frontBorder.rotationPointX * f5, this.frontBorder.rotationPointY * f5, this.frontBorder.rotationPointZ * f5); GL11.glScaled(1.0D, 0.8D, 1.0D); GL11.glTranslatef(-this.frontBorder.offsetX, -this.frontBorder.offsetY, -this.frontBorder.offsetZ); GL11.glTranslatef(-this.frontBorder.rotationPointX * f5, -this.frontBorder.rotationPointY * f5, -this.frontBorder.rotationPointZ * f5); this.frontBorder.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslatef(this.rightBorder.offsetX, this.rightBorder.offsetY, this.rightBorder.offsetZ); GL11.glTranslatef(this.rightBorder.rotationPointX * f5, this.rightBorder.rotationPointY * f5, this.rightBorder.rotationPointZ * f5); GL11.glScaled(1.0D, 0.8D, 1.0D); GL11.glTranslatef(-this.rightBorder.offsetX, -this.rightBorder.offsetY, -this.rightBorder.offsetZ); GL11.glTranslatef(-this.rightBorder.rotationPointX * f5, -this.rightBorder.rotationPointY * f5, -this.rightBorder.rotationPointZ * f5); this.rightBorder.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslatef(this.backBorder.offsetX, this.backBorder.offsetY, this.backBorder.offsetZ); GL11.glTranslatef(this.backBorder.rotationPointX * f5, this.backBorder.rotationPointY * f5, this.backBorder.rotationPointZ * f5); GL11.glScaled(1.0D, 0.8D, 1.0D); GL11.glTranslatef(-this.backBorder.offsetX, -this.backBorder.offsetY, -this.backBorder.offsetZ); GL11.glTranslatef(-this.backBorder.rotationPointX * f5, -this.backBorder.rotationPointY * f5, -this.backBorder.rotationPointZ * f5); this.backBorder.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslatef(this.leftBorder.offsetX, this.leftBorder.offsetY, this.leftBorder.offsetZ); GL11.glTranslatef(this.leftBorder.rotationPointX * f5, this.leftBorder.rotationPointY * f5, this.leftBorder.rotationPointZ * f5); GL11.glScaled(1.0D, 0.8D, 1.0D); GL11.glTranslatef(-this.leftBorder.offsetX, -this.leftBorder.offsetY, -this.leftBorder.offsetZ); GL11.glTranslatef(-this.leftBorder.rotationPointX * f5, -this.leftBorder.rotationPointY * f5, -this.leftBorder.rotationPointZ * f5); this.leftBorder.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslatef(this.pit.offsetX, this.pit.offsetY, this.pit.offsetZ); GL11.glTranslatef(this.pit.rotationPointX * f5, this.pit.rotationPointY * f5, this.pit.rotationPointZ * f5); GL11.glScaled(1.0D, 0.5D, 1.0D); GL11.glTranslatef(-this.pit.offsetX, -this.pit.offsetY, -this.pit.offsetZ); GL11.glTranslatef(-this.pit.rotationPointX * f5, -this.pit.rotationPointY * f5, -this.pit.rotationPointZ * f5); this.pit.render(f5); GL11.glPopMatrix(); }
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 w w . j a v a 2s . c o 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();/*w w w. j a va 2 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();/*w w w. java 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 ww w. j a va 2 s.c o m*/ 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.DisintegraterItemRenderer.java
License:Open Source License
private void renderCupola(ImmutableTriple<Float, Float, Float> offset) { GL11.glPushMatrix();/*from ww w .j av a 2 s .c o m*/ GL11.glScalef(SCALE.left, SCALE.middle, SCALE.right); GL11.glTranslatef(offset.left, offset.middle, offset.right); FMLClientHandler.instance().getClient().renderEngine.bindTexture(DisintegraterTESR.TEXTURE); model.render(); GL11.glPopMatrix(); }