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.lambdacraft.terrain.client.renderer.RenderTileXenAmethyst.java
License:Open Source License
/** * Render the Amethyst ray/*from w w w .j a v a2s. c o m*/ * @param ent * @param t * @param x * @param y * @param z */ private void renderRay(TileEntityXenAmethyst ent, Tessellator t, double x, double y, double z) { double dx = ent.lastxCoord, dy = ent.lastyCoord, dz = ent.lastzCoord; // double tx = 0.0, ty = 0.4, tz = 0.0; double tx = 0.5, ty = 0.2, tz = 0.5; GL11.glPushMatrix(); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderUtils.loadTexture(ClientProps.VORTIGAUNT_RAY_PATH[rng.nextInt(3)]); Vec3 v1 = RenderUtils.newV3(tx - WIDTH, ty, tz), v2 = RenderUtils.newV3(tx + WIDTH, ty, tz), v3 = RenderUtils.newV3(tx, ty - WIDTH, tz), v4 = RenderUtils.newV3(tx, ty + WIDTH, tz); double d = Math.sqrt(dx * dx + dy * dy + dz * dz) * 1.3; GL11.glTranslated(x, y, z); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); t.startDrawingQuads(); t.setBrightness(15728880); t.setColorRGBA_F(0.663F, 0.263F, 1.0F, 0.65F); RenderUtils.addVertex(v1, 0, 0); RenderUtils.addVertex(v2, 1, 0); RenderUtils.addVertex(v2.addVector(dx, dy, dz), 1, d); RenderUtils.addVertex(v1.addVector(dx, dy, dz), 0, d); RenderUtils.addVertex(v3, 0, 0); RenderUtils.addVertex(v4, 1, 0); RenderUtils.addVertex(v4.addVector(dx, dy, dz), 1, d); RenderUtils.addVertex(v3.addVector(dx, dy, dz), 0, d); t.draw(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); }
From source file:cn.lambdalib.cgui.gui.CGui.java
License:MIT License
private void drawTraverse(double mx, double my, Widget cur, WidgetContainer set, Widget top) { try {/* ww w .j a v a 2s . c om*/ if (cur != null && cur.isVisible()) { GL11.glPushMatrix(); GL11.glTranslated(cur.x, cur.y, 0); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glScaled(cur.scale, cur.scale, 1); GL11.glTranslated(-cur.transform.pivotX, -cur.transform.pivotY, 0); GL11.glColor4d(1, 1, 1, 1); //Force restore color for any widget cur.post(new FrameEvent((mx - cur.x) / cur.scale, (my - cur.y) / cur.scale, cur == top)); GL11.glPopMatrix(); } } catch (Exception e) { LambdaLib.log.error("Error occured handling widget draw. instance class: " + cur.getClass().getName() + ", name: " + cur.getName()); e.printStackTrace(); } if (cur == null || cur.isVisible()) { Iterator<Widget> iter = set.iterator(); while (iter.hasNext()) { Widget wn = iter.next(); drawTraverse(mx, my, wn, wn, top); } } }
From source file:cn.lambdalib.multiblock.RenderBlockMulti.java
License:MIT License
@Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) { if (!(te.getBlockType() instanceof BlockMulti)) return;/*from w w w .j a v a2 s .co m*/ BlockMulti bm = (BlockMulti) te.getBlockType(); InfoBlockMulti inf = ((IMultiTile) te).getBlockInfo(); if (inf == null || !inf.isLoaded() || inf.subID != 0) return; GL11.glPushMatrix(); double[] off = bm.getPivotOffset(inf); double[] off2 = bm.rotCenters[inf.dir.ordinal()]; GL11.glTranslated(x + off[0] + off2[0], y + 0 + off2[1], z + off[1] + off2[2]); // GL11.glTranslated(x, y, z); GL11.glRotated(bm.getRotation(inf), 0, 1, 0); drawAtOrigin(te); GL11.glPopMatrix(); }
From source file:cn.lambdalib.particle.RenderParticle.java
License:MIT License
@Override public void doRender(Entity ent, double x, double y, double z, float a, float b) { if (RenderUtils.isInShadowPass()) return;/* w w w . j a v a 2s . co m*/ Particle ish = (Particle) ent; if (!ish.updated) return; ish.updateSprite(sprite); GL11.glAlphaFunc(GL11.GL_GREATER, 0.05f); GL11.glPushMatrix(); if (ish.needViewOptimize()) { GL11.glTranslated(0, -0.2, 0); } GL11.glTranslated(x, y, z); if (ish.customRotation) { GL11.glRotatef(ish.rotationYaw, 0, 1, 0); GL11.glRotatef(ish.rotationPitch, 0, 0, 1); } else { GL11.glRotatef(180F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); } sprite.draw(); GL11.glPopMatrix(); GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.1f); }
From source file:cn.lambdalib.template.client.render.block.RenderTileEntityModel.java
License:MIT License
@Override public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) { GL11.glPushMatrix();/*from w w w. j av a 2 s . co m*/ { GL11.glTranslated(d0 + .5, d1 + yOffset, d2 + .5); if (reverse) { GL11.glScaled(-scale, -scale, scale); } else { GL11.glScaled(scale, scale, scale); } RenderUtils.loadTexture(texture); model.render(tileentity, 0F, 0F); } GL11.glPopMatrix(); }
From source file:cn.lambdalib.template.client.render.entity.RenderCrossedProjectile.java
License:MIT License
@Override public void doRender(Entity entity, double par2, double par4, double par6, float par8, float par9) { Motion3D motion = new Motion3D(entity); Tessellator t = Tessellator.instance; GL11.glPushMatrix();//from ww w . j a v a2 s . com { Vec3 v1 = newV3(0, HEIGHT, 0), v2 = newV3(0, -HEIGHT, 0), v3 = newV3(LENGTH, -HEIGHT, 0), v4 = newV3(LENGTH, HEIGHT, 0), v5 = newV3(0, 0, -HEIGHT), v6 = newV3(0, 0, HEIGHT), v7 = newV3(LENGTH, 0, HEIGHT), v8 = newV3(LENGTH, 0, -HEIGHT); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); if (renderTexture) { bindTexture(TEXTURE_PATH); } else { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(colorR, colorG, colorB); } if (ignoreLight) { GL11.glDisable(GL11.GL_LIGHTING); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); } GL11.glTranslatef((float) par2, (float) par4, (float) par6); GL11.glRotatef(90 + entity.rotationYaw, 0.0F, -1.0F, 0.0F); // ? GL11.glRotatef(-entity.rotationPitch, 0.0F, 0.0F, 1.0F); // if (this.playerViewOptm) { boolean firstPerson = Minecraft.getMinecraft().gameSettings.thirdPersonView == 0; if (firstPerson) { GL11.glTranslated(fpOffsetX, fpOffsetY, fpOffsetZ); } else { GL11.glTranslated(tpOffsetX, tpOffsetY, tpOffsetZ); } } t.startDrawingQuads(); if (ignoreLight) t.setBrightness(15728880); RenderUtils.addVertex(v1, 0, 0); RenderUtils.addVertex(v2, 0, 1); RenderUtils.addVertex(v3, 1, 1); RenderUtils.addVertex(v4, 1, 0); RenderUtils.addVertex(v5, 0, 0); RenderUtils.addVertex(v6, 0, 1); RenderUtils.addVertex(v7, 1, 1); RenderUtils.addVertex(v8, 1, 0); t.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); } GL11.glPopMatrix(); }
From source file:cn.lambdalib.template.client.render.item.RenderModelItem.java
License:MIT License
public void renderInventory() { GL11.glDisable(GL11.GL_CULL_FACE);/*from www . j a v a 2s.co m*/ GL11.glPushMatrix(); { RenderUtils.loadTexture(texturePath); GL11.glTranslated(8.0F + invOffset.x, 8.0F + invOffset.y, 0.0F); GL11.glScaled(16F * invScale, 16F * invScale, 16F * invScale); float rotation = 145F; if (inventorySpin) rotation = GameTimer.getAbsTime() / 100F; GL11.glRotatef(rotation, 0, 1, 0); this.doRotation(invRotation); GL11.glScalef(-1F, -1F, 1F); renderAtStdPosition(); } GL11.glPopMatrix(); GL11.glEnable(GL11.GL_CULL_FACE); }
From source file:cn.lambdalib.template.client.render.item.RenderModelItem.java
License:MIT License
protected void doTransformation(Vec3 vec3) { if (vec3 != null) GL11.glTranslated(vec3.xCoord, vec3.yCoord, vec3.zCoord); }
From source file:cn.lambdalib.util.client.RenderUtils.java
License:MIT License
public static void glTranslate(Vec3 v) { GL11.glTranslated(v.xCoord, v.yCoord, v.zCoord); }
From source file:cn.lambdalib.util.client.RenderUtils.java
License:MIT License
public static void drawBlackout() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glDisable(GL11.GL_CULL_FACE);/*from www .j a va2s .c om*/ GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glPushMatrix(); GL11.glLoadIdentity(); GLU.gluOrtho2D(1, 0, 1, 0); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glColor4d(0, 0, 0, 0.7); GL11.glTranslated(0, 0, 0); HudUtils.colorRect(0, 0, 1, 1); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glColor4d(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glMatrixMode(GL11.GL_MODELVIEW); }