List of usage examples for org.lwjgl.opengl GL11 glTranslated
public static native void glTranslated(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y, @NativeType("GLdouble") double z);
From source file:cn.academy.energy.client.render.block.RenderWindGenMain.java
License:GNU General Public License
@Override public void drawAtOrigin(TileEntity te) { TileWindGenMain gen = (TileWindGenMain) te; GL11.glPushMatrix();/* ww w .j a v a 2 s. c om*/ // draw body RenderUtils.loadTexture(texBody); mdlBody.renderAll(); // draw fan if (gen.isFanInstalled() && gen.noObstacle) { // update fan rotation long time = GameTimer.getTime(); long dt = gen.lastFrame == -1 ? 0 : time - gen.lastFrame; gen.lastFrame = time; gen.lastRotation += gen.getSpinSpeed() * dt / 1000.0; GL11.glPushMatrix(); GL11.glTranslated(0, 0.5, 0.82); GL11.glRotated(gen.lastRotation, 0, 0, -1); RenderUtils.loadTexture(texFan); mdlFan.renderAll(); GL11.glPopMatrix(); } GL11.glPopMatrix(); }
From source file:cn.academy.energy.client.render.tile.RenderMatrix.java
License:Open Source License
@Override public void renderAtOrigin(TileEntity te) { TileMatrix tm = (TileMatrix) te;//from w ww . ja va2s . c o m GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glPushMatrix(); { GL11.glTranslated(-1, 0, -1); double scale = 0.22; GL11.glScaled(scale, scale, scale); RenderUtils.loadTexture(tex); GL11.glDepthMask(true); model.renderPart("base"); GL11.glPushMatrix(); { GL11.glTranslated(0, 6.3, 0); drawCube(tm.isLoaded); } GL11.glPopMatrix(); GL11.glDepthMask(false); RenderUtils.loadTexture(tex); model.renderPart("plate"); } GL11.glPopMatrix(); }
From source file:cn.academy.energy.client.render.tile.RenderMatrix.java
License:Open Source License
private void drawCube(boolean load) { GL11.glTranslated(0, 0.6 * Math.sin(Minecraft.getSystemTime() / 400D), 0); if (load) {/*ww w. j a v a 2 s . c o m*/ GL11.glRotated(Minecraft.getSystemTime() / 25D, 1, 1, 1); GL11.glRotated(Minecraft.getSystemTime() / 50D, 2, 0, 1); } else { GL11.glTranslated(0, -1.5, 0); } final double size = 3.2, hs = size * 0.5; GL11.glTranslated(-hs, -hs, -hs); GL11.glColor4d(1, 1, 1, 0.7); RenderUtils.loadTexture(ACClientProps.TEX_MDL_GRID_BLOCK); RenderUtils.drawCube(size, size, size); GL11.glColor4d(1, 1, 1, 1); }
From source file:cn.academy.energy.client.render.tile.RenderNode.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float w) { TileNode node = (TileNode) te;/*from w ww. ja v a2 s .c o m*/ RenderUtils.loadTexture(TEX); GL11.glPushMatrix(); { GL11.glTranslated(x, y, z); for (int i = 0; i < 4; ++i) { GL11.glPushMatrix(); GL11.glTranslated(offsets[i][0], 0, offsets[i][1]); GL11.glRotated(rots[i], 0, 1, 0); //original rect.setSize(1, 1); rect.map.set(0, 0, 32.0 / 34.0, 1); piece.draw(); //energy bar GL11.glTranslated(-0.001, 4 / 32.0, 21.0 / 32.0); double cur = node.getEnergy() / node.getMaxEnergy(); rect.map.set(32.0 / 34.0, 0, 2.0 / 34.0, cur * (15.0 / 32.0)); rect.setSize(2.0 / 34.0, cur * (15.0 / 32.0)); piece.draw(); GL11.glPopMatrix(); } rect.setSize(1, 1); RenderUtils.loadTexture(TEX_BTM); GL11.glPushMatrix(); GL11.glTranslated(1, 0, 0); GL11.glRotated(90, 0, 0, 1); rect.map.set(0, 0, 1, 1); piece.draw(); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(0, 1, 0); GL11.glRotated(-90, 0, 0, 1); piece.draw(); GL11.glPopMatrix(); } GL11.glPopMatrix(); }
From source file:cn.academy.energy.client.render.tile.RenderSolarGen.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float u) { GL11.glPushMatrix();//from ww w.j a va 2s . c o m GL11.glTranslated(x + .5, y, z + .5); double scale = 0.018; GL11.glScaled(scale, scale, scale); RenderUtils.loadTexture(tex); model.renderAll(); GL11.glPopMatrix(); }
From source file:cn.academy.knowledge.client.ui.LifeRecordUI.java
License:Open Source License
private void drawHoveringText(Knowledge l, double mx, double my) { final double SIZE_NAME = 48, SIZE_DESC = 44; final double W_MARGIN = 20, H_MARGIN = 10; GL11.glPushMatrix();/*from www. j a v a 2 s. co m*/ GL11.glTranslated(mx + 60, my + 5, 1); Font font = Font.font; double len = Math.max(font.strLen(l.getName(), SIZE_NAME), font.strLen(l.getDesc(), SIZE_DESC)); double x = -W_MARGIN, y = -H_MARGIN, w = len + 2 * W_MARGIN, h = 46 + SIZE_DESC + 2 * H_MARGIN; HudUtils.pushZLevel(); HudUtils.zLevel = 0; temp.fromHexColor(0xb4343434); temp.bind(); HudUtils.colorRect(x, y, w, h); temp.fromHexColor(0xa49d9d9d); temp.bind(); HudUtils.drawRectOutline(x, y, w, h, 2); HudUtils.popZLevel(); font.draw(l.getName(), 0, 0, SIZE_NAME, 0xdcdcdc); font.draw(l.getDesc(), 0, 46, SIZE_DESC, 0xb7dcdcdc); GL11.glColor4d(1, 1, 1, 1); GL11.glPopMatrix(); }
From source file:cn.academy.misc.client.render.RendererCoin.java
License:Open Source License
@Override public void doRender(Entity var1, double x, double y, double z, float var8, float var9) { EntityThrowingCoin etc = (EntityThrowingCoin) var1; EntityPlayer player = etc.player;//ww w . j a v a2 s . c om boolean fp = player == Minecraft.getMinecraft().thePlayer && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0; double dt = Minecraft.getSystemTime() - etc.getEntityData().getLong("startTime"); if (etc.isSync) return; GL11.glPushMatrix(); { GL11.glTranslated(x, y, z); if (fp) { GL11.glRotated(player.rotationYaw, 0, -1, 0); } else GL11.glRotated(player.renderYawOffset, 0, -1, 0); GL11.glTranslated(-0.63, -0.60, 0.30); float scale = 0.3F; GL11.glScalef(scale, scale, scale); GL11.glTranslated(0.5, 0.5, 0); GL11.glRotated(dt * 2, etc.axis.xCoord, etc.axis.yCoord, etc.axis.zCoord); GL11.glTranslated(-0.5, -0.5, 0); RenderUtils.renderItemIn2d(0.0625, ACClientProps.TEX_COIN_FRONT, ACClientProps.TEX_COIN_BACK); } GL11.glPopMatrix(); }
From source file:cn.academy.misc.client.render.RendererMagHook.java
License:Open Source License
@Override public void doRender(Entity ent, double x, double y, double z, float a, float b) { EntityMagHook hook = (EntityMagHook) ent; IModelCustom realModel = model;/*from www . jav a 2 s . c o m*/ if (hook.isHit) { realModel = model_open; hook.preRender(); x = hook.posX - RenderManager.renderPosX; y = hook.posY - RenderManager.renderPosY; z = hook.posZ - RenderManager.renderPosZ; } GL11.glPushMatrix(); RenderUtils.loadTexture(ACClientProps.TEX_MDL_MAGHOOK); GL11.glTranslated(x, y, z); GL11.glRotated(-hook.rotationYaw + 90, 0, 1, 0); GL11.glRotated(hook.rotationPitch - 90, 0, 0, 1); double scale = 0.0054; GL11.glScaled(scale, scale, scale); realModel.renderAll(); GL11.glPopMatrix(); }
From source file:cn.academy.misc.client.render.RendererRayBase.java
License:Open Source License
@Override public final void doRender(Entity var1, double x, double y, double z, float h, float a) { long time = Minecraft.getSystemTime(); T er = (T) var1; if (!er.isLoaded()) { return;// www. j ava2 s . c o m } er.beforeRender(); x = er.posX - RenderManager.renderPosX; y = er.posY - RenderManager.renderPosY; z = er.posZ - RenderManager.renderPosZ; EntityPlayer clientPlayer = Minecraft.getMinecraft().thePlayer; boolean firstPerson = Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 && clientPlayer.equals(er.getSpawner()); double len = er.getDisplayRayLen(); //System.out.println(firstPerson); if (er.doesFollowSpawner()) { //Pos injection, for better viewing effect x = 0; y = 0; z = 0; } GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_CULL_FACE); if (disableLight) GL11.glDisable(GL11.GL_LIGHTING); GL11.glPushMatrix(); { GL11.glTranslated(x, y, z); GL11.glRotated(er.rotationYaw, 0, -1, 0); GL11.glRotated(er.rotationPitch, 1, 0, 0); GL11.glColor4d(1, 1, 1, alpha * er.getAlpha()); if (firstPerson) { if (er.isNearPlayer()) transformFirstPerson(er, x, y, z); } else { if (er.isNearPlayer()) transformThirdPerson(er, x, y, z); optimizeView(er, x, y, z); } if (disableLight) { OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); Tessellator.instance.setBrightness(15728880); } drawAtOrigin(er, len, firstPerson); } GL11.glPopMatrix(); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); }
From source file:cn.academy.misc.client.render.RendererRayBase.java
License:Open Source License
protected void transformFirstPerson(T ent, double x, double y, double z) { if (this.viewOptimize) GL11.glTranslated(fpOffsetX, fpOffsetY, fpOffsetZ); }