List of usage examples for org.lwjgl.opengl GL11 glScalef
public static native void glScalef(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);
From source file:com.professorvennie.machinerycraft.client.gui.book.GuiBook.java
License:Creative Commons License
@Override public void drawScreen(int par1, int par2, float par3) { GL11.glColor4f(1F, 1F, 1F, 1F);//from w w w.j ava2 s .c om mc.renderEngine.bindTexture(texture); drawTexturedModalRect(left, top, 0, 0, guiWidth, guiHeight); drawCenteredString(fontRendererObj, getTitle(), left + guiWidth / 2, top - getTitleHeight(), 0xFF5A28); String subtitle = getSubtitle(); if (subtitle != null) { GL11.glScalef(0.5F, 0.5F, 1F); drawCenteredString(fontRendererObj, subtitle, left * 2 + guiWidth, (top - getTitleHeight() + 10) * 2, 0xFF5A28); GL11.glScalef(2F, 2F, 1F); } drawHeader(); super.drawScreen(par1, par2, par3); }
From source file:com.professorvennie.machinerycraft.client.renderer.tileentity.TileEntityRendererPlasticChest.java
License:Creative Commons License
@Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) { if (tileEntity instanceof TileEntityPlasticChest) { TileEntityPlasticChest tileEntityPlasticChest = (TileEntityPlasticChest) tileEntity; ForgeDirection direction = null; if (tileEntityPlasticChest.getWorldObj() != null) { direction = tileEntityPlasticChest.getOrientation(); //System.out.println(tileEntityPlasticChest.getOrientation()); }/*from www. j av a 2 s .c o m*/ this.bindTexture(texture); GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_LIGHTING); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F); GL11.glScalef(1.0F, -1.0F, -1.0F); GL11.glTranslatef(0.5F, 0.5F, 0.5F); short angle = 0; if (direction != null) { if (direction == ForgeDirection.NORTH) { angle = 180; } else if (direction == ForgeDirection.SOUTH) { angle = 0; } else if (direction == ForgeDirection.WEST) { angle = 90; } else if (direction == ForgeDirection.EAST) { angle = -90; } } GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); float adjustedLidAngle = tileEntityPlasticChest.prevLidAngle + (tileEntityPlasticChest.lidAngle - tileEntityPlasticChest.prevLidAngle) * tick; adjustedLidAngle = 1.0F - adjustedLidAngle; adjustedLidAngle = 1.0F - adjustedLidAngle * adjustedLidAngle * adjustedLidAngle; modelChest.chestLid.rotateAngleX = -(adjustedLidAngle * (float) Math.PI / 2.0F); modelChest.renderAll(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glDisable(GL11.GL_LIGHTING); GL11.glPopMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } }
From source file:com.runescape.client.revised.editor.modelviewer.Model3D.java
License:Open Source License
public void render(final float x, final float y, final float z, final float rx, final float ry, final float rz, final float sx, final float sy, final float sz) { GL11.glLoadIdentity();/*from w ww .jav a 2 s. c o m*/ GL11.glTranslatef(x, y, z); GL11.glRotatef(rx, 1.0F, 0.0F, 0.0F); GL11.glRotatef(ry, 0.0F, 1.0F, 0.0F); GL11.glRotatef(rz, 0.0F, 0.0F, 1.0F); GL11.glScalef(sx, sy, sz); final short[] tri_x = this.triangle_viewspace_x; final short[] tri_y = this.triangle_viewspace_y; final short[] tri_z = this.triangle_viewspace_z; // final short[] tex_map_x = this.texture_map_x; // final short[] tex_map_y = this.texture_map_y; // final short[] tex_map_z = this.texture_map_z; final short[] textures = this.textures; final int[] vertices_x = this.vertices_x; final int[] vertices_y = this.vertices_y; final int[] vertices_z = this.vertices_z; final short[] colors = this.colors; final float model_scale = 4.0F; final float texture_scale = 1.0F; if (this.pointers != null) { //glEnable(GL_DEPTH_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); //GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); //GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); } Texture texture = null; for (int triangle = 0; triangle != this.triangle_count; ++triangle) { if ((this.alpha != null) && (this.alpha[triangle] == -1)) { continue; } final int point_a = tri_x[triangle]; final int point_b = tri_y[triangle]; final int point_c = tri_z[triangle]; final int color = Model.hsl2rgb[colors[triangle] & 0xffff]; int triangle_type; if (this.face_fill_attributes == null) { triangle_type = 0; } else { triangle_type = this.face_fill_attributes[triangle] & 3; } if ((textures != null) && (textures[triangle] != -1)) { final int id = textures[triangle] & 0xffff; if (ModelConstants.ENABLE_MODEL_TEXTURES && ((texture == null) && (id != -1))) { texture = TextureCache.get(id); } if (texture != null) { texture.bind(); } } final boolean textured = ModelConstants.ENABLE_MODEL_TEXTURES && (texture != null); GL11.glBegin(GL11.GL_TRIANGLES); GL11.glColor4ub((byte) (color >>> 16), (byte) (color >>> 8), (byte) color, (byte) (this.alpha == null ? 0xff : ~this.alpha[triangle])); switch (triangle_type) { case 0://shaded triangle case 1://flat triangle if (textured) { GL11.glTexCoord2f(0.0F, 0.0F); } GL11.glVertex3f(vertices_x[point_a] / model_scale, vertices_y[point_a] / model_scale, vertices_z[point_a] / model_scale); if (textured) { GL11.glTexCoord2f(0.0F, texture_scale / model_scale); } GL11.glVertex3f(vertices_x[point_b] / model_scale, vertices_y[point_b] / model_scale, vertices_z[point_b] / model_scale); if (textured) { GL11.glTexCoord2f(texture_scale / model_scale, texture_scale / model_scale); } GL11.glVertex3f(vertices_x[point_c] / model_scale, vertices_y[point_c] / model_scale, vertices_z[point_c] / model_scale); break; case 2://textured? case 3://textured? final int ptr = this.face_fill_attributes[triangle] >> 2; final int tex_point_a = this.texture_map_x[ptr]; final int tex_point_b = this.texture_map_y[ptr]; final int tex_point_c = this.texture_map_z[ptr]; GL11.glTexCoord2f(0.0F, 0.0F); GL11.glVertex3f(vertices_x[tex_point_a] / model_scale, vertices_y[tex_point_a] / model_scale, vertices_z[tex_point_a] / model_scale); GL11.glTexCoord2f(0.0F, texture_scale / model_scale); GL11.glVertex3f(vertices_x[tex_point_b] / model_scale, vertices_y[tex_point_b] / model_scale, vertices_z[tex_point_b] / model_scale); GL11.glTexCoord2f(texture_scale / model_scale, texture_scale / model_scale); GL11.glVertex3f(vertices_x[tex_point_c] / model_scale, vertices_y[tex_point_c] / model_scale, vertices_z[tex_point_c] / model_scale); break; } GL11.glEnd(); } if (texture != null) { GL11.glDisable(GL11.GL_TEXTURE_2D); } }
From source file:com.rvantwisk.cnctools.opengl.View2D.java
License:Open Source License
@Override public void display_transform() { // _center_on_origin GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity();//from w w w . j av a2 s . c o m GL11.glOrtho(-camera.getX(), camera.getX(), -camera.getY(), camera.getY(), NEAR, FAR); GL11.glMatrixMode(GL11.GL_MODELVIEW); // _center_on_origin GL11.glTranslatef(camera.getX(), camera.getY(), camera.getZ()); GL11.glRotatef(camera.getAzimuth(), 0.0f, 0.0f, 1.0f); GL11.glScalef(camera.getZoom_factor(), camera.getZoom_factor(), camera.getZoom_factor()); }
From source file:com.rvantwisk.cnctools.opengl.View3D.java
License:Open Source License
@Override public void display_transform() { GL11.glRotatef(-90f, 1.0f, 0.0f, 0.0f); GL11.glTranslatef(0.0f, camera.getY(), 0.0f); float f = camera.getZoom_factor(); if (camera.isOrtho()) { f *= camera.getZOOM_ORTHO_ADJ(); }//from ww w.ja v a 2 s .co m GL11.glScalef(f, f, f); GL11.glTranslatef(camera.getX(), 0.0f, camera.getZ()); GL11.glRotatef(-camera.getElevation(), 1.0f, 0.0f, 0.0f); GL11.glRotatef(camera.getAzimuth(), 0.0f, 0.0f, 1.0f); GL11.glTranslatef(camera.getOffset_x(), camera.getOffset_y(), 0.0f); }
From source file:com.savageboy74.savagetech.client.render.tileentity.TileEntityRendererLootBox.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) { if (tileEntity instanceof TileEntityLootBox) { TileEntityLootBox tileEntityLootBox = (TileEntityLootBox) tileEntity; ForgeDirection direction = null; if (tileEntityLootBox.getWorldObj() != null) { direction = tileEntityLootBox.getOrientation(); }/* ww w. java 2 s .com*/ this.bindTexture(Textures.Model.LOOT_BOX); GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F); GL11.glScalef(1.0F, -1.0F, -1.0F); GL11.glTranslatef(0.5F, 0.5F, 0.5F); short angle = 0; if (direction != null) { if (direction == ForgeDirection.NORTH) { angle = 180; } else if (direction == ForgeDirection.SOUTH) { angle = 0; } else if (direction == ForgeDirection.WEST) { angle = 90; } else if (direction == ForgeDirection.EAST) { angle = -90; } } GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); float adjustedLidAngle = tileEntityLootBox.prevLidAngle + (tileEntityLootBox.lidAngle - tileEntityLootBox.prevLidAngle) * tick; adjustedLidAngle = 1.0F - adjustedLidAngle; adjustedLidAngle = 1.0F - adjustedLidAngle * adjustedLidAngle * adjustedLidAngle; modelChest.chestLid.rotateAngleX = -(adjustedLidAngle * (float) Math.PI / 2.0F); modelChest.renderAll(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } }
From source file:com.sci.machinery.render.RenderTube.java
License:LGPL
public void renderItem(TravellingItem item, double x, double y, double z) { if (item == null) return;//from w w w.j a v a 2s . c om if (item.getStack() == null) return; float renderScale = 0.3f; GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.1f, (float) y - 0.175f, (float) z + 0.1f); GL11.glTranslatef(0, 0.25F, 0); GL11.glScalef(renderScale, renderScale, renderScale); dummyEntityItem.setEntityItemStack(item.getStack()); item.setRotation(item.getRotation() + 0.5f % 360); customRenderItem.doRenderItem(dummyEntityItem, 0, 0, 0, 0, item.getRotation()); GL11.glPopMatrix(); }
From source file:com.shinoow.abyssalcraft.client.gui.necronomicon.buttons.ButtonCategory.java
License:Apache License
@Override public void drawButton(Minecraft mc, int mx, int my) { FontRenderer fr = mc.fontRenderer;/*from w w w .j a v a2 s.c o m*/ boolean inside = mx >= xPosition && my >= yPosition && mx < xPosition + width && my < yPosition + height; float time = 5F; if (inside) ticksHovered = Math.min(time, ticksHovered); else ticksHovered = Math.max(0F, ticksHovered); ResourceLocation res = getTexture(icon); if (res == null) res = getTexture(AbyssalCraft.necronomicon); mc.renderEngine.bindTexture(res); float s = 1F / 48F; GL11.glPushMatrix(); GL11.glColor4f(1F, 1F, 1F, 1); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glScalef(0.5F, 0.5F, 0.5F); drawTexturedModalRect(xPosition * 2, yPosition * 2, zLevel * 2, 0, 0, 48, 48, s, s); // drawTexturedModalRect(xPosition, yPosition, 0, 16, 48, 48); GL11.glPopMatrix(); fr.drawString(displayString, xPosition + 20, yPosition + 10, 0); }
From source file:com.shinoow.abyssalcraft.client.handlers.AbyssalCraftClientEventHooks.java
License:Apache License
private void renderStarSpawnPlayer(EntityPlayer player, float partialTicks) { mc.renderEngine.bindTexture(new ResourceLocation("abyssalcraft:textures/model/tentacles.png")); for (int j = 0; j < 1; ++j) { GL11.glColor4f(1F, 1F, 1F, 1F);//from w w w.ja v a2 s . c o m float f10 = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks - (player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks); float f2 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks; GL11.glPushMatrix(); GL11.glFrontFace(GL11.GL_CW); GL11.glRotatef(f10, 0.0F, 1.0F, 0.0F); GL11.glRotatef(f2, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(0, -0.22F, 0); GL11.glScalef(1, 1, 1); model.renderTentacles(0.0625F); GL11.glFrontFace(GL11.GL_CCW); GL11.glPopMatrix(); } }
From source file:com.shinoow.abyssalcraft.client.model.entity.ModelChagaroth.java
License:Apache License
@Override public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { GL11.glPushMatrix();/*from ww w . jav a 2s . c om*/ super.render(entity, f, f1, f2, f3, f4, f5); GL11.glScalef(2.0F, 2.0F, 2.0F); GL11.glTranslatef(0F, -0.75F, 0F); setRotationAngles(f, f1, f2, f3, f4, f5, entity); frontspike1.render(f5); frontspike2.render(f5); frontspike3.render(f5); frontspike4.render(f5); frontspike5.render(f5); leftneck.render(f5); middleneck.render(f5); rightneck.render(f5); body.render(f5); tentacle2base.render(f5); tentacle1.render(f5); tentacle2.render(f5); tentacle3.render(f5); tentacle4.render(f5); tentacle5.render(f5); tentacle6.render(f5); tentacle7.render(f5); tentacle8.render(f5); tentacle9.render(f5); tentacle10.render(f5); tentacle11.render(f5); tentacle12.render(f5); tentacle13.render(f5); tentacle14.render(f5); tentacle15.render(f5); tentacle16.render(f5); tentacle17.render(f5); tentacle18.render(f5); tentacle19.render(f5); tentacle20.render(f5); tlib12.render(f5); tlib22.render(f5); tspike12.render(f5); tspike22.render(f5); tspike32.render(f5); tspike42.render(f5); tlib1.render(f5); tlib2.render(f5); tspike1.render(f5); tspike2.render(f5); tspike3.render(f5); tspike4.render(f5); lefthead.render(f5); middlehead.render(f5); righthead.render(f5); middlewall.render(f5); rightwall.render(f5); leftwall.render(f5); walltentacle1.render(f5); walltentacle2.render(f5); walltentacle3.render(f5); walltentacle4.render(f5); walltentacle5.render(f5); walltentacle6.render(f5); walltentacle7.render(f5); walltentacle8.render(f5); GL11.glPopMatrix(); }