List of usage examples for org.lwjgl.opengl GL11 glRotatef
public static native void glRotatef(@NativeType("GLfloat") float angle, @NativeType("GLfloat") float x, @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);
From source file:Robot.java
public void draw() { updateAngles();//from w ww .ja va 2 s . c om updateLocation(); GL11.glPushMatrix(); GL11.glScalef(0.5f, 0.5f, 0.5f); // drawing the torso GL11.glTranslatef(torsoX, torsoY, 0); GL11.glRotatef(torsoAngle[CURRENT_ANGLE], 0, 0, 1); drawTorso(); // drawing the neck GL11.glPushMatrix(); GL11.glTranslatef(0, TORSO_HEIGHT, 0); GL11.glRotatef(neckAngle[CURRENT_ANGLE], 0, 0, 1); drawNeck(); // drawing the head GL11.glTranslatef(0, NECK_HEIGHT + HEAD_RADIUS, 0); GL11.glRotatef(headAngle[CURRENT_ANGLE], 0, 0, 1); drawHead(); GL11.glPopMatrix(); // drawing the right arms GL11.glPushMatrix(); GL11.glTranslatef(TORSO_WIDTH / 2, TORSO_HEIGHT - UPPER_ARM_HEIGHT, 0); GL11.glRotatef(upperRightArmAngle[CURRENT_ANGLE], 0, 0, 1); drawUpperRightArm(); GL11.glTranslatef(UPPER_ARM_WIDTH, LOWER_ARM_HEIGHT, 0); GL11.glRotatef(lowerRightArmAngle[CURRENT_ANGLE], 0, 0, 1); drawLowerRightArm(); GL11.glPopMatrix(); // drawing the left arms GL11.glPushMatrix(); GL11.glScalef(-1, 1, 1); // same as the right arm but on the other side GL11.glTranslatef(TORSO_WIDTH / 2, TORSO_HEIGHT - UPPER_ARM_HEIGHT, 0); GL11.glRotatef(upperLeftArmAngle[CURRENT_ANGLE], 0, 0, 1); drawUpperLeftArm(); GL11.glTranslatef(UPPER_ARM_WIDTH, LOWER_ARM_HEIGHT, 0); GL11.glRotatef(lowerLeftArmAngle[CURRENT_ANGLE], 0, 0, 1); drawLowerLeftArm(); GL11.glPopMatrix(); // drawing the right leg GL11.glPushMatrix(); GL11.glTranslatef(TORSO_WIDTH / 4 - THIGH_WIDTH / 2, 0, 0); GL11.glRotatef(rightThighAngle[CURRENT_ANGLE], 0, 0, 1); drawRightThigh(); GL11.glTranslatef(0, -THIGH_HEIGHT, 0); GL11.glRotatef(rightCalfAngle[CURRENT_ANGLE], 0, 0, 1); drawRightCalf(); GL11.glPopMatrix(); // drawing the left leg GL11.glPushMatrix(); GL11.glScalef(-1, 1, 1); // same as the right arm but on the other side GL11.glTranslatef(TORSO_WIDTH / 4 - THIGH_WIDTH / 2, 0, 0); GL11.glRotatef(leftThighAngle[CURRENT_ANGLE], 0, 0, 1); drawLeftThigh(); GL11.glTranslatef(0, -THIGH_HEIGHT, 0); GL11.glRotatef(leftCalfAngle[CURRENT_ANGLE], 0, 0, 1); drawLeftCalf(); GL11.glPopMatrix(); GL11.glPopMatrix(); }
From source file:$.DrawSystem.java
License:Open Source License
private void drawSprite(Sprite sprite) { Vector pos = spriteProjector.project(sprite.getPosition()); final IPlay play = sprite.getPlay(); if (null != play) { GL11.glPushMatrix();/*from w w w .ja v a2s . c o m*/ GL11.glTranslatef(pos.x, pos.y, 0.0f); GL11.glRotatef(sprite.getRotate(), 0, 0, 1.0f); GL11.glScalef(sprite.getScale(), sprite.getScale(), 1); final IAnimationFrame frame = play.getCurrentFrame(); final IAnimationImage image = frame.getImage(); if (image.hasAlpha()) { GL11.glEnable(GL11.GL_BLEND); } GL11.glBindTexture(GL11.GL_TEXTURE_2D, (Integer) image.getId()); final float u1, u2; if (sprite.isMirrorX()) { u1 = frame.getU2(); u2 = frame.getU1(); } else { u1 = frame.getU1(); u2 = frame.getU2(); } final float v1, v2; if (sprite.isMirrorY()) { v1 = frame.getV1(); v2 = frame.getV2(); } else { v1 = frame.getV2(); v2 = frame.getV1(); } GL11.glColor4f(sprite.getRed(), sprite.getGreen(), sprite.getBlue(), sprite.getAlpha()); float x1 = -sprite.getWidth() / 2.0f; float x2 = sprite.getWidth() / 2.0f; float y1 = -sprite.getHeight() / 2.0f; float y2 = sprite.getHeight() / 2.0f; GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(u1, v1); GL11.glVertex2f(x1, y2); GL11.glTexCoord2f(u2, v1); GL11.glVertex2f(x2, y2); GL11.glTexCoord2f(u2, v2); GL11.glVertex2f(x2, y1); GL11.glTexCoord2f(u1, v2); GL11.glVertex2f(x1, y1); GL11.glEnd(); GL11.glColor3f(1f, 1f, 1f); if (image.hasAlpha()) { GL11.glDisable(GL11.GL_BLEND); } GL11.glPopMatrix(); } if (null != sprite.getLabel()) { GL11.glPushMatrix(); GL11.glTranslatef(pos.x, pos.y, 0.0f); GL11.glScalef(0.5f, -0.5f, 1f); GL11.glEnable(GL11.GL_BLEND); LwjglNuitFont font = (LwjglNuitFont) assets.getFont(""); font.drawString(sprite.getLabel(), LwjglNuitFont.Align.CENTER); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } }
From source file:adrianton.gloptat.plotter.Displayer.java
License:Open Source License
private void surface() { GL11.glLoadIdentity();// www.j av a 2 s. c o m GL11.glTranslatef(posx, posy, posz); GL11.glRotatef(roty, 1, 0, 0); GL11.glRotatef(rotz, 0, 0, 1); GL11.glScaled(0.3, 0.3, 0.3); GL11.glScaled(pasz, pasz, pasz); Surface.call(); }
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); }/*ww w. j a v a 2s . c o m*/ 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();//w ww. ja va2 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();// ww w.j av a2s . co m 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 {/* w ww .j ava2 s. c om*/ 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;/*from ww w .ja v a 2s .c o m*/ 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(); } }