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:nightkosh.gravestone_extended.renderer.tileentity.TileEntitySpawnerRenderer.java
License:LGPL
/** * Render a skull tile entity.//from w w w . j av a 2 s. c om */ public void renderSpawnerPentagramAt(TileEntitySpawner tileEntity, float x, float y, float z, float par8) { if (tileEntity == null) { tileEntity = getDefaultTE(); } byte type = (byte) tileEntity.getBlockMetadata(); EnumSpawner spawnerType = EnumSpawner.getById(type); GL11.glPushMatrix(); if (tileEntity.getWorld() != null) { if (spawnerType == EnumSpawner.SPIDER_SPAWNER) { GL11.glTranslatef(x + 0.5F, y + 0.75F, z + 0.5F); GL11.glScalef(0.5F, -0.5F, -0.5F); } else { GL11.glTranslatef(x + 0.5F, y + 1.5F, z + 0.5F); GL11.glScalef(1, -1, -1); } } else { if (spawnerType == EnumSpawner.SPIDER_SPAWNER) { GL11.glTranslatef(x + 0.5F, y + 0.5F, z + 0.5F); GL11.glScalef(0.3F, -0.3F, -0.3F); } else { GL11.glTranslatef(x + 0.5F, y + 1, z + 0.5F); GL11.glScalef(0.6F, -0.6F, -0.6F); } } GL11.glTranslated(0, -0.01, 0); if (spawnerType == EnumSpawner.SPIDER_SPAWNER) { this.bindTexture(Resources.SPIDER_SPAWNER); } else { this.bindTexture(Resources.PENTAGRAM); } ModelSpawnerBase spawner = getSpawnerModel(spawnerType); spawner.renderAll(); GL11.glPopMatrix(); }
From source file:org.blockartistry.mod.ThermalRecycling.machines.entity.renderers.VendingTileEntityRenderer.java
License:MIT License
@Override public void renderTileEntityAt(final TileEntity te, final double x, final double y, final double z, final float scale) { final VendingTileEntity vte = (VendingTileEntity) te; if (vte != null) { playerRange = Minecraft.getMinecraft().thePlayer.getDistanceSq(vte.xCoord, vte.yCoord, vte.zCoord); }//from w w w. jav a 2s .c o m GL11.glPushMatrix(); // Offset our image so it aligns right with // the voxel grid GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5); bindTexture(texture); GL11.glPushMatrix(); // Flip GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); int rotation = 0; if (vte != null) { // Rotate based on facing rotation = rotationFacings[te.getBlockMetadata() & 7]; GL11.glRotatef(rotation, 0.0F, 1.0F, 0.0F); } else { // Render the item in inventory GL11.glTranslated(0F, 0.5F, 0F); GL11.glRotatef(90, 0F, 1.0F, 0F); } // Render model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); // Render the contents of the trade inventory if (vte != null) { if (playerInRange(ITEM_RENDER_RANGE)) renderTradeInventory(vte); if (playerInRange(VENDING_TITLE_RENDER_RANGE)) renderName(vte.getOwnerName()); } GL11.glPopMatrix(); GL11.glPopMatrix(); }
From source file:org.cogaen.lwjgl.scene.Camera.java
License:Open Source License
void applyTransform() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity();//from w w w. j a v a 2 s .com GL11.glOrtho(0, this.width, 0, this.height, 1, -1); GL11.glTranslated(this.width / 2, this.height / 2, 0.0); GL11.glScaled(this.zoom, this.zoom, 0.0); GL11.glRotatef((float) -this.angle, 0, 0, 1); GL11.glTranslated(-this.posX, -this.posY, 0); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glViewport(this.viewport.getX(), this.viewport.getY(), this.viewport.getWidth(), this.viewport.getHeight()); }
From source file:org.cogaen.lwjgl.scene.ParticleSystem.java
License:Open Source License
private void renderParticle(Particle particle) { double p = particle.getLifeTime() / particle.getTimeToLive(); double size = this.startSize * p + this.endSize * (1 - p); GL11.glPushMatrix();/* w w w. j a v a2 s. c om*/ GL11.glTranslated(particle.getPosX(), particle.getPosY(), 0); GL11.glRotatef((float) (particle.getAngle() * RAD2DEG), 0, 0, 1); Color c = this.visual.getColor(); c.setRed(this.startColor.getRed() * p + this.endColor.getRed() * (1 - p)); c.setGreen(this.startColor.getGreen() * p + this.endColor.getGreen() * (1 - p)); c.setBlue(this.startColor.getBlue() * p + this.endColor.getBlue() * (1 - p)); c.setAlpha(this.startColor.getAlpha() * p + this.endColor.getAlpha() * (1 - p)); this.visual.setScale(size); this.visual.render(); GL11.glPopMatrix(); }
From source file:org.cogaen.lwjgl.scene.SceneNode.java
License:Open Source License
void renderWithAspectRatio(int mask, double ar) { GL11.glPushMatrix();//from ww w . j a v a2 s .c o m GL11.glTranslated(this.posX, this.posY / ar, 0.0); GL11.glRotatef((float) this.angle, 0, 0, 1); for (Visual visual : this.visuals) { if ((visual.getMask() & mask) != 0) { visual.prolog(); visual.render(); visual.epilog(); } } for (SceneNode node : this.nodes) { node.renderWithAspectRatio(mask, ar); } GL11.glPopMatrix(); }
From source file:org.cogaen.lwjgl.scene.SceneNode.java
License:Open Source License
void render(int mask) { GL11.glPushMatrix();//from ww w. j ava2s . co m GL11.glTranslated(this.posX, this.posY, 0.0); GL11.glRotatef((float) this.angle, 0, 0, 1); for (Visual visual : this.visuals) { if ((visual.getMask() & mask) != 0) { visual.prolog(); visual.render(); visual.epilog(); } } for (SceneNode node : this.nodes) { node.render(mask); } GL11.glPopMatrix(); }
From source file:org.fe.gameplay.world.World.java
License:Open Source License
@Override public void render() { int cameraX = this.cameraX, cameraY = this.cameraY; GL11.glTranslated(-cameraX, -cameraY / 2, 0); terrain.render(cameraX, cameraY / 2, (int) width, (int) height); Entity[] ent = getEntities(); Arrays.sort(ent);//ww w .ja va 2 s.c om for (Entity e : ent) { if (fogOfWar.isVisible((int) e.x / 32, (int) e.y / 32)) e.render(); } for (int i = 0; i < effects.length; i++) { Effect e = effects[i]; if (e != null && e.onScreen(cameraX, cameraY, (int) width, (int) height)) { e.render(); if (e.remove) { effects[i] = null; } } } fogOfWar.render(cameraX, cameraY / 2, (int) width, (int) height); for (Entity e : ent) { if (e.onScreen(cameraX, cameraY, (int) width, (int) height)) { if (fogOfWar.isVisible((int) e.x / 32, (int) e.y / 32)) e.renderGUI(); } } if (FMouse.left) { Main.GRAPHICS.setColor(new Color(0, 0, 0, 0.15f)); Main.GRAPHICS.fillRect(selectX, (selectY) / 2, selectX2 - selectX, (selectY2 - selectY) / 2); Main.GRAPHICS.setColor(Color.white); Main.GRAPHICS.drawRect(selectX, (selectY) / 2, selectX2 - selectX, (selectY2 - selectY) / 2); } GL11.glTranslated(cameraX, cameraY / 2, 0); super.render(); }
From source file:org.getspout.spout.entity.RenderTexture.java
License:Open Source License
@Override public void doRender(Entity entity, double x, double y, double z, float yaw, float pitch) { EntityTexture entityT = (EntityTexture) entity; if (entityT.texture == null) { entityT.texture = CustomTextureManager.getTextureFromUrl(entityT.getUrl()); if (entityT.texture == null) { return; }/*from w w w . ja v a 2 s. c om*/ } GL11.glPushMatrix(); RenderHelper.disableStandardItemLighting(); yaw = entityT.isRotateWithPlayer() ? -this.renderManager.playerViewY : yaw; GL11.glTranslated(x, y, z); GL11.glRotatef(yaw, 0, 1.0F, 0); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glBindTexture(GL11.GL_TEXTURE_2D, entityT.texture.getTextureID()); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); double h = entityT.height * 0.014; double w = entityT.width * 0.014; tessellator.addVertexWithUV(w / 2, -h / 2, 0, 0.0D, 0.0D); //draw corners tessellator.addVertexWithUV(-w / 2, -h / 2, 0, entityT.texture.getWidth(), 0.0D); tessellator.addVertexWithUV(-w / 2, h / 2, 0, entityT.texture.getWidth(), entityT.texture.getHeight()); tessellator.addVertexWithUV(w / 2, h / 2, 0, 0.0D, entityT.texture.getHeight()); tessellator.draw(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); RenderHelper.enableStandardItemLighting(); GL11.glPopMatrix(); }
From source file:org.jackhuang.watercraft.client.render.RecolorableItemRenderer.java
License:Minecraft Mod Public
@Override public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { int meta = stack.getItemDamage(); ItemRecolorable item = (ItemRecolorable) stack.getItem(); GL11.glEnable(GL11.GL_BLEND);/*from w ww. j a va 2 s . c o m*/ if (type == ItemRenderType.ENTITY) { if (RenderItem.renderInFrame) { GL11.glScalef(0.85F, 0.85F, 0.85F); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glTranslated(-0.5D, -0.42D, 0.0D); } else { GL11.glTranslated(-0.5D, -0.42D, 0.0D); } } GL11.glColor3f(1.0F, 1.0F, 1.0F); IIconContainer iconContainer = item.getIconContainer(meta); IIcon icon = stack.getIconIndex(); if (icon == null) return; Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); GL11.glBlendFunc(770, 771); short[] rgb = item.getRGBA(stack); GL11.glColor3f(rgb[0] / 255.0F, rgb[1] / 255.0F, rgb[2] / 255.0F); if (type.equals(IItemRenderer.ItemRenderType.INVENTORY)) renderIcon(icon, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F); else ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F); GL11.glColor3f(1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); }
From source file:org.spout.api.gui.layout.AbstractLayout.java
License:Open Source License
@Override public void render() { for (Widget widget : attachedWidgets) { double x = widget.getGeometry().getX(); double y = widget.getGeometry().getY(); GL11.glTranslated(x, y, 0); GL11.glColor4d(1, 1, 1, 1);//w w w .j av a2s. co m GL11.glPushMatrix(); widget.render(); GL11.glPopMatrix(); GL11.glTranslated(-x, -y, 0); } }