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.stormister.rediscovered.RenderTileEntityTable.java
License:Open Source License
/** * Renders the TileEntity for the chest at a position. *///from ww w . j a v a 2 s.c o m public void render(TileEntityTable par1TileEntityChest, double par2, double par4, double par6, float par8) { int i; this.bindTexture(field_110871_a); if (!par1TileEntityChest.hasWorldObj()) { i = 0; } else { Block block = par1TileEntityChest.getBlockType(); i = par1TileEntityChest.getBlockMetadata(); if (block instanceof BlockTable && i == 0) { i = par1TileEntityChest.getBlockMetadata(); } } ModelTable modelchest; modelchest = this.chestModel; GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef((float) par2, (float) par4 + 1.0F, (float) par6 + 1.0F); GL11.glScalef(1.0F, -1.0F, -1.0F); GL11.glTranslatef(0.5F, 0.5F, 0.5F); short short1 = 0; GL11.glRotatef((float) short1, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); float f1 = par1TileEntityChest.prevLidAngle + (par1TileEntityChest.lidAngle - par1TileEntityChest.prevLidAngle) * par8; float f2; f1 = 1.0F - f1; f1 = 1.0F - f1 * f1 * f1; modelchest.renderAll(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); //*********************************************** //RENDERS ITEM ON TABLE //*********************************************** // ItemStack itemstack = par1TileEntityChest.getTopItemStacks(); // // if (itemstack != null) // { // EntityItem entityitem = new EntityItem(par1TileEntityChest.worldObj, 0.0D, 0.0D, 0.0D, itemstack); // entityitem.getEntityItem().stackSize = 1; // entityitem.hoverStart = 0.0F; // GL11.glPushMatrix(); // GL11.glTranslatef(-0.453125F * (float)Direction.offsetX[par1TileEntityChest.hangingDirection], -0.18F, -0.453125F * (float)Direction.offsetZ[par1TileEntityChest.hangingDirection]); // GL11.glRotatef(180.0F + par1TileEntityChest.rotationYaw, 0.0F, 1.0F, 0.0F); // GL11.glRotatef((float)(-90 * par1TileEntityChest.getRotation()), 0.0F, 0.0F, 1.0F); // RenderItem.renderInFrame = true; // RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); // RenderItem.renderInFrame = false; // GL11.glPopMatrix(); // } }
From source file:com.swinggl.backend.Debug.java
License:Open Source License
public static void render(GLFrame frame) { if (enabled) { GL11.glPushMatrix();//from www. ja v a 2s . co m GL11.glTranslatef(0f, 10f, 0f); engineFontBold.drawString("SwingGL v" + GLFrame.VERSION, 2, 18, fontColor); engineFontBold.drawString("FPS:", 2, 38, fontColor); engineFontBold.drawString("UPS:", 2, 58, fontColor); engineFontBold.drawString("Current GLPanel:", 2, 78, fontColor); engineFont.drawString(frame.getPanel().toString(), 180, 78, fontColor); engineFontBold.drawString("Render time:", 2, 98, fontColor); engineFontBold.drawString("Theory Max FPS: ", 2, 138, fontColor); renderSum += renderDelta; updateSum += updateDelta; renderTimeSum += renderTime; if (timer == 20) { avgRenderDelta = renderSum / 20.0; renderSum = 0.0; avgUpdateDelta = updateSum / 20.0; updateSum = 0.0; avgRenderTime = renderTimeSum / 20.0; renderTimeSum = 0L; timer = 0; } timer++; engineFont.drawString(noNotation.format(1.0 / avgRenderDelta), 50, 38, fontColor); engineFont.drawString(noNotation.format(1.0 / avgUpdateDelta), 50, 58, fontColor); engineFont.drawString(noNotation.format(avgRenderTime) + "ns", 140, 98, fontColor); engineFont.drawString(noNotationLong.format(avgRenderTime / 1000000000.0) + "s", 140, 118, fontColor); engineFont.drawString(noNotation.format(1.0 / (avgRenderTime / 1000000000.0)) + " fps", 178, 138, fontColor); GL11.glPopMatrix(); } }
From source file:com.teambr.bookshelf.client.gui.component.NinePatchRenderer.java
License:Creative Commons License
protected void renderTopEdge(Gui gui, int width) { GL11.glPushMatrix();/*from w w w .java 2s. c o m*/ GL11.glTranslatef(cellSize, 0, 0); GL11.glScalef(width - (cellSize * 2), 1, 0); gui.drawTexturedModalRect(0, 0, u + cellSize, v, 1, cellSize); GL11.glPopMatrix(); }
From source file:com.teambr.bookshelf.client.gui.component.NinePatchRenderer.java
License:Creative Commons License
protected void renderBottomEdge(Gui gui, int width, int height) { GL11.glPushMatrix();//from ww w. ja v a2s .co m GL11.glTranslatef(cellSize, height - cellSize, 0); GL11.glScalef(width - (cellSize * 2), 1, 0); gui.drawTexturedModalRect(0, 0, u + cellSize, v + cellSize + cellSize, 1, cellSize); GL11.glPopMatrix(); }
From source file:com.teambr.bookshelf.client.gui.component.NinePatchRenderer.java
License:Creative Commons License
protected void renderLeftEdge(Gui gui, int height) { GL11.glPushMatrix();/*from w w w.j ava 2 s . c o m*/ GL11.glTranslatef(0, cellSize, 0); GL11.glScalef(1, height - (cellSize * 2), 0); gui.drawTexturedModalRect(0, 0, u, v + cellSize, cellSize, 1); GL11.glPopMatrix(); }
From source file:com.teambr.bookshelf.client.gui.component.NinePatchRenderer.java
License:Creative Commons License
protected void renderRightEdge(Gui gui, int width, int height) { GL11.glPushMatrix();/*from w ww . j a va2 s . c o m*/ GL11.glTranslatef(width - cellSize, cellSize, 0); GL11.glScalef(1, height - (cellSize * 2), 0); gui.drawTexturedModalRect(0, 0, u + cellSize + cellSize, v + cellSize, cellSize, 1); GL11.glPopMatrix(); }
From source file:com.teambr.bookshelf.client.gui.component.NinePatchRenderer.java
License:Creative Commons License
protected void renderBackground(Gui gui, int width, int height) { GL11.glPushMatrix();//from ww w. j a v a 2s .c o m GL11.glTranslatef(cellSize - 1, cellSize - 1, 0); GL11.glScalef(width - (cellSize * 2) + 2, height - (cellSize * 2) + 2, 0); gui.drawTexturedModalRect(0, 0, u + cellSize, v + cellSize, 1, 1); GL11.glPopMatrix(); }
From source file:com.teambr.bookshelf.client.gui.component.NinePatchRenderer.java
License:Creative Commons License
/** * Main render call. This must be called in the parent gui to render the box. * * WARNING: Will bind texture to sheet, make sure you rebind afterwards or do this first * * @param gui The screen being rendered onto * @param x Screen X Position/*w w w . j a v a 2 s. c o m*/ * @param y Screen Y Position * @param width Width * @param height Height * @param color Color to render */ public void render(Gui gui, int x, int y, int width, int height, Color color) { GL11.glPushMatrix(); if (color != null) RenderUtils.setColor(color); if (patchLocation != null) RenderUtils.bindTexture(patchLocation); GL11.glTranslatef(x, y, 0); renderBackground(gui, width, height); renderTopEdge(gui, width); renderBottomEdge(gui, width, height); renderRightEdge(gui, width, height); renderLeftEdge(gui, height); renderTopLeftCorner(gui); renderTopRightCorner(gui, width); renderBottomLeftCorner(gui, height); renderBottomRightCorner(gui, width, height); GL11.glPopMatrix(); }
From source file:com.telinc1.rpjg.module.ModuleMap.java
License:Apache License
@Override public void renderGraphics() { // Get references to our map and player. Player player = Game.getGame().getPlayer(); Map map = Game.getGame().getMap(); // Render the current map. GL11.glPushMatrix();//from w w w. java 2 s . co m // Standard centering algorithm, just need to add half a tile // to completely center because of the 16:9 resolution. int cameraX = (player.getPixelX() - Display.getWidth() / 2) + (GameOptions.GRID_SIZE / 2); int cameraY = (player.getPixelY() - Display.getHeight() / 2) + (GameOptions.GRID_SIZE / 2); GL11.glTranslatef(-cameraX, -cameraY, 0); // Render the map's tiles. DrawingUtils.bindTexture(TextureLoader.tilesetTexture); DrawingUtils.startDrawing(GL11.GL_QUADS); for (int x = 0; x < map.getWidth(); x++) { for (int y = 0; y < map.getHeight(); y++) { Tile tile = map.getTileAt(x, y); // XXX: Is there a way to make this look nicer? DrawingUtils.drawTexturedTile(tile.getDisplayModifier().getTextureID(tile, map, x, y), x, y); } } DrawingUtils.stopDrawing(); // Render all events, including the player. DrawingUtils.drawTexturedEvent(player); for (Event event : map.getEvents()) { if (event instanceof EventTextured) { DrawingUtils.drawTexturedEvent((EventTextured) event); } } DrawingUtils.stopDrawing(); GL11.glPopMatrix(); // Render the version in the top corner, just for information purposes. FontRenderer.drawString(String.format("%s-%s v.%s", GameOptions.GAME_NAME, GameOptions.GAME_BUILD, GameOptions.GAME_VERSION), FontRenderer.small, 3, 3, Color.BLACK); }
From source file:com.theoriginalbit.moarperipherals.client.render.RendererItemSonic.java
License:Apache License
@Override protected void manipulateEntityRender(ItemStack stack) { float scale = 0.145f; GL11.glScalef(scale, scale, scale);//from w ww. j a v a 2 s .co m GL11.glRotatef(180, 1, 0, 0); GL11.glTranslatef(0f, -1f, 0f); }