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:adrianton.gloptat.plotter.Displayer.java
License:Open Source License
private void pointers() { if (pointers != null) { float spx = -rezx / 2f; float spy = -rezy / 2f; float tmpx, tmpy; float rapx, rapy; int tmpi, tmpj; rapx = rezx / (float) (dom.d[0].r - dom.d[0].l); rapy = rezy / (float) (dom.d[1].r - dom.d[1].l); int i;//from ww w. j a v a 2s.co m for (i = 0; i < pointers.length; i++) { tmpx = spx + (float) (pointers[i][0] - dom.d[0].l) * rapx; tmpy = spy + (float) (pointers[i][1] - dom.d[1].l) * rapy; tmpi = (int) ((pointers[i][0] - dom.d[0].l) * rapx); // should interpolate tmpj = (int) ((pointers[i][1] - dom.d[1].l) * rapy); tmpi = Math.min(Math.max(0, tmpi), rezx - 1); tmpj = Math.min(Math.max(0, tmpj), rezy - 1); if (dom.in(pointers[i])) { GL11.glPushMatrix(); GL11.glTranslatef(tmpx, tmpy, (float) (val[tmpi][tmpj])); GL11.glScaled(1.1, 1.1, 0.5); Pointer.call(); GL11.glPopMatrix(); } } } }
From source file:advancedbrewing.renderer.ItemGlintOverlayRenderer.java
License:Minecraft Mod Public
@Override public void renderItem(ItemRenderType type, ItemStack itemStack, Object... data) { if (type == ItemRenderType.ENTITY) { if (RenderManager.instance.options.fancyGraphics) { if (RenderItem.renderInFrame) { GL11.glTranslatef(0.0F, -0.05F, -0.084375F); GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); }/*from w w w. j a v a2 s. c om*/ GL11.glTranslatef(-0.5F, -0.25F, -(0.084375F * ItemGlintOverlayRenderer.RENDERITEM.getMiniItemCount(itemStack) / 2.0F)); this.renderItem3D(type, itemStack, data); } else { if (!RenderItem.renderInFrame) { GL11.glRotatef(180.0F - RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F); } TextureManager renderEngine = FMLClientHandler.instance().getClient().renderEngine; Tessellator tessellator = Tessellator.instance; // render colored overlay renderEngine.bindTexture(renderEngine.getResourceLocation(itemStack.getItemSpriteNumber())); this.setColorByItemStack(itemStack); Icon icon = this.getIcon(itemStack, 0); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F, 0.0F); tessellator.addVertexWithUV((-0.5F), (-0.25F), 0.0D, icon.getMinU(), icon.getMaxV()); tessellator.addVertexWithUV((0.5F), (-0.25F), 0.0D, icon.getMaxU(), icon.getMaxV()); tessellator.addVertexWithUV((0.5F), (0.75F), 0.0D, icon.getMaxU(), icon.getMinV()); tessellator.addVertexWithUV((-0.5F), (0.75F), 0.0D, icon.getMinU(), icon.getMinV()); tessellator.draw(); // render uncolored icon this.setColorByItemStack(itemStack); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); icon = this.getIcon(itemStack, 1); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F, 0.0F); tessellator.addVertexWithUV((-0.5F), (-0.25F), 0.0D, icon.getMinU(), icon.getMaxV()); tessellator.addVertexWithUV((0.5F), (-0.25F), 0.0D, icon.getMaxU(), icon.getMaxV()); tessellator.addVertexWithUV((0.5F), (0.75F), 0.0D, icon.getMaxU(), icon.getMinV()); tessellator.addVertexWithUV((-0.5F), (0.75F), 0.0D, icon.getMinU(), icon.getMinV()); tessellator.draw(); } } else if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) { this.renderItem3D(type, itemStack, data); } else if (type == ItemRenderType.INVENTORY) { this.renderItem2D(type, itemStack, data); } }
From source file:advancedbrewing.renderer.ItemGlintOverlayRenderer.java
License:Minecraft Mod Public
private void renderItem3D(ItemRenderType type, ItemStack itemStack, Object... data) { TextureManager renderEngine = FMLClientHandler.instance().getClient().renderEngine; Tessellator tessellator = Tessellator.instance; if (this.shouldRenderOverlay(itemStack)) { // render colored overlay renderEngine.bindTexture(renderEngine.getResourceLocation(itemStack.getItemSpriteNumber())); this.setColorByItemStack(itemStack); Icon icon = this.getIcon(itemStack, 0); ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F); // render glint if (itemStack.hasEffect(0)) { renderEngine.bindTexture(ItemGlintOverlayRenderer.RES_ITEM_GLINT); GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F); // first pass GL11.glPushMatrix();/*from ww w .ja va 2 s . co m*/ GL11.glScalef(0.125F, 0.125F, 0.125F); float f9 = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F; GL11.glTranslatef(f9, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); // second pass GL11.glPushMatrix(); GL11.glScalef(0.125F, 0.125F, 0.125F); f9 = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F; GL11.glTranslatef(-f9, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } } // render uncolored icon renderEngine.bindTexture(renderEngine.getResourceLocation(itemStack.getItemSpriteNumber())); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); Icon icon = this.getIcon(itemStack, 1); ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F); }
From source file:akarnokd.opengl.experiment.Planet.java
License:Apache License
/** Draw with full position and rotation information. */ public void drawFull() { GL11.glPushMatrix();//from w w w . ja va 2 s. c om GL11.glTranslatef(x, y, z); GL11.glRotatef(rotate, 0, 0, 1); draw(); GL11.glPopMatrix(); }
From source file:akarnokd.opengl.experiment.Planet.java
License:Apache License
public void drawFull(boolean forSelect) { GL11.glPushMatrix(); GL11.glTranslatef(x, y, z); GL11.glRotatef(rotate, 0, 0, 1); draw(forSelect); GL11.glPopMatrix(); }
From source file:akarnokd.opengl.experiment.Planet.java
License:Apache License
public void drawWireframe() { GL11.glPushMatrix(); GL11.glTranslatef(x, y, z); GL11.glRotatef(rotate, 0, 0, 1); GL11.glCallList(wireframe); GL11.glPopMatrix(); }
From source file:analog.clock.AnalogClock.java
private void loop() { try {/* ww w. j a v a 2s. com*/ for (int i = 0; i < 1000; i++) { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); drawCircle(0.25, 8); // draw the sun earthOrbitAngle += 1; moonOrbitAngle += 5; earthAxisAngle += 10; GL11.glPushMatrix(); GL11.glRotatef(earthOrbitAngle, 0, 0, 1); GL11.glTranslatef(0.75f, 0.0f, 0.0f); GL11.glPushMatrix(); GL11.glRotatef(earthAxisAngle, 0, 0, 1); GL11.glScalef(0.5f, 0.5f, 0.5f); drawCircle(0.25, 3); // draw the earth GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glRotatef(moonOrbitAngle, 0, 0, 1); GL11.glTranslatef(0.25f, 0.0f, 0.0f); GL11.glScalef(0.25f, 0.25f, 0.25f); drawCircle(0.25, 5); // draw the moon GL11.glPopMatrix(); GL11.glPopMatrix(); Thread.sleep(10); GLFW.glfwSwapBuffers(window); } } catch (InterruptedException ex) { Logger.getLogger(AnalogClock.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:appeng.client.ClientHelper.java
License:Open Source License
@Override public void doRenderItem(final ItemStack itemstack, final World w) { if (itemstack != null) { final EntityItem entityitem = new EntityItem(w, 0.0D, 0.0D, 0.0D, itemstack); entityitem.getEntityItem().stackSize = 1; // set all this stuff and then do shit? meh? entityitem.hoverStart = 0;// w w w .j a va2s . c om entityitem.age = 0; entityitem.rotationYaw = 0; GL11.glPushMatrix(); GL11.glTranslatef(0, -0.04F, 0); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); // GL11.glDisable( GL11.GL_CULL_FACE ); if (itemstack.isItemEnchanted() || itemstack.getItem().requiresMultipleRenderPasses()) { GL11.glTranslatef(0.0f, -0.05f, -0.25f); GL11.glScalef(1.0f / 1.5f, 1.0f / 1.5f, 1.0f / 1.5f); // GL11.glTranslated( -8.0, -12.2, -10.6 ); GL11.glScalef(1.0f, -1.0f, 0.005f); // GL11.glScalef( 1.0f , -1.0f, 1.0f ); final Block block = Block.getBlockFromItem(itemstack.getItem()); if ((itemstack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(block.getRenderType()))) { GL11.glRotatef(25.0f, 1.0f, 0.0f, 0.0f); GL11.glRotatef(15.0f, 0.0f, 1.0f, 0.0f); GL11.glRotatef(30.0f, 0.0f, 1.0f, 0.0f); } final IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, IItemRenderer.ItemRenderType.ENTITY); if (customRenderer != null && !(itemstack.getItem() instanceof ItemBlock)) { if (customRenderer.shouldUseRenderHelper(IItemRenderer.ItemRenderType.ENTITY, itemstack, IItemRenderer.ItemRendererHelper.BLOCK_3D)) { GL11.glTranslatef(0, -0.04F, 0); GL11.glScalef(0.7f, 0.7f, 0.7f); GL11.glRotatef(35, 1, 0, 0); GL11.glRotatef(45, 0, 1, 0); GL11.glRotatef(-90, 0, 1, 0); } } else if (itemstack.getItem() instanceof ItemBlock) { GL11.glTranslatef(0, -0.04F, 0); GL11.glScalef(1.1f, 1.1f, 1.1f); GL11.glRotatef(-90, 0, 1, 0); } else { GL11.glTranslatef(0, -0.14F, 0); GL11.glScalef(0.8f, 0.8f, 0.8f); } RenderItem.renderInFrame = true; RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); RenderItem.renderInFrame = false; } else { GL11.glScalef(1.0f / 42.0f, 1.0f / 42.0f, 1.0f / 42.0f); GL11.glTranslated(-8.0, -10.2, -10.4); GL11.glScalef(1.0f, 1.0f, 0.005f); RenderItem.renderInFrame = false; final FontRenderer fr = Minecraft.getMinecraft().fontRenderer; if (!ForgeHooksClient.renderInventoryItem(BLOCK_RENDERER, Minecraft.getMinecraft().renderEngine, itemstack, true, 0, 0, 0)) { ITEM_RENDERER.renderItemIntoGUI(fr, Minecraft.getMinecraft().renderEngine, itemstack, 0, 0, false); } } GL11.glPopMatrix(); } }
From source file:appeng.client.gui.widgets.GuiImgButton.java
License:Open Source License
@Override public void drawButton(final Minecraft par1Minecraft, final int par2, final int par3) { if (this.visible) { final int iconIndex = this.getIconIndex(); if (this.halfSize) { this.width = 8; this.height = 8; GL11.glPushMatrix();/*from w w w.j av a 2s .co m*/ GL11.glTranslatef(this.xPosition, this.yPosition, 0.0F); GL11.glScalef(0.5f, 0.5f, 0.5f); if (this.enabled) { GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); } else { GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0f); } par1Minecraft.renderEngine.bindTexture(ExtraBlockTextures.GuiTexture("guis/states.png")); this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; final int uv_y = (int) Math.floor(iconIndex / 16); final int uv_x = iconIndex - uv_y * 16; this.drawTexturedModalRect(0, 0, 256 - 16, 256 - 16, 16, 16); this.drawTexturedModalRect(0, 0, uv_x * 16, uv_y * 16, 16, 16); this.mouseDragged(par1Minecraft, par2, par3); GL11.glPopMatrix(); } else { if (this.enabled) { GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); } else { GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0f); } par1Minecraft.renderEngine.bindTexture(ExtraBlockTextures.GuiTexture("guis/states.png")); this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; final int uv_y = (int) Math.floor(iconIndex / 16); final int uv_x = iconIndex - uv_y * 16; this.drawTexturedModalRect(this.xPosition, this.yPosition, 256 - 16, 256 - 16, 16, 16); this.drawTexturedModalRect(this.xPosition, this.yPosition, uv_x * 16, uv_y * 16, 16, 16); this.mouseDragged(par1Minecraft, par2, par3); } } GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); }
From source file:appeng.client.render.BaseBlockRender.java
License:Open Source License
public void doRenderItem(final ItemStack itemstack, final TileEntity par1EntityItemFrame) { if (itemstack != null) { final EntityItem entityitem = new EntityItem(par1EntityItemFrame.getWorldObj(), 0.0D, 0.0D, 0.0D, itemstack);//from w ww . j a v a2s.c o m entityitem.getEntityItem().stackSize = 1; // set all this stuff and then do shit? meh? entityitem.hoverStart = 0; entityitem.age = 0; entityitem.rotationYaw = 0; GL11.glPushMatrix(); GL11.glTranslatef(0, -0.14F, 0); RenderItem.renderInFrame = true; RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); RenderItem.renderInFrame = false; GL11.glPopMatrix(); } }