List of usage examples for org.lwjgl.opengl GL11 glPushMatrix
public static native void glPushMatrix();
From source file:buildcraft.core.gui.GuiAdvancedInterface.java
License:Minecraft Mod Public
protected void drawBackgroundSlots() { int cornerX = (width - xSize) / 2; int cornerY = (height - ySize) / 2; RenderHelper.enableGUIStandardItemLighting(); GL11.glPushMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(32826 /* GL_RESCALE_NORMAL_EXT */); int i1 = 240; int k1 = 240; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, i1 / 1.0F, k1 / 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); for (AdvancedSlot slot : slots) { if (slot != null) { slot.drawSprite(cornerX, cornerY); }/* w ww.j a v a 2 s . c o m*/ } GL11.glPopMatrix(); }
From source file:buildcraft.core.gui.GuiBuildCraft.java
License:Minecraft Mod Public
/** * Draws the screen and all the components in it. *///from www .ja va 2s .c o m @Override public void drawScreen(int mouseX, int mouseY, float par3) { super.drawScreen(mouseX, mouseY, par3); int left = this.guiLeft; int top = this.guiTop; GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glPushMatrix(); GL11.glTranslatef(left, top, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); RenderHelper.disableStandardItemLighting(); InventoryPlayer playerInv = this.mc.thePlayer.inventory; if (playerInv.getItemStack() == null) { drawToolTips(container.getWidgets(), mouseX, mouseY); drawToolTips(buttonList, mouseX, mouseY); drawToolTips(inventorySlots.inventorySlots, mouseX, mouseY); } GL11.glPopMatrix(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); }
From source file:buildcraft.core.lib.engines.RenderEngine.java
License:Minecraft Mod Public
private void render(float progress, ForgeDirection orientation, ResourceLocation baseTexture, ResourceLocation chamberTexture, ResourceLocation trunkTexture, double x, double y, double z) { if (BuildCraftCore.render == RenderMode.NoDynamic) { return;/*w w w .j av a 2s . c o m*/ } GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glColor3f(1, 1, 1); GL11.glTranslatef((float) x, (float) y, (float) z); float step; if (progress > 0.5) { step = 7.99F - (progress - 0.5F) * 2F * 7.99F; } else { step = progress * 2F * 7.99F; } float translatefact = step / 16; float[] angle = { 0, 0, 0 }; float[] translate = { orientation.offsetX, orientation.offsetY, orientation.offsetZ }; switch (orientation) { case EAST: case WEST: case DOWN: angle[2] = angleMap[orientation.ordinal()]; break; case SOUTH: case NORTH: default: angle[0] = angleMap[orientation.ordinal()]; break; } box.rotateAngleX = angle[0]; box.rotateAngleY = angle[1]; box.rotateAngleZ = angle[2]; trunk.rotateAngleX = angle[0]; trunk.rotateAngleY = angle[1]; trunk.rotateAngleZ = angle[2]; movingBox.rotateAngleX = angle[0]; movingBox.rotateAngleY = angle[1]; movingBox.rotateAngleZ = angle[2]; chamber.rotateAngleX = angle[0]; chamber.rotateAngleY = angle[1]; chamber.rotateAngleZ = angle[2]; float factor = (float) (1.0 / 16.0); bindTexture(baseTexture); box.render(factor); GL11.glTranslatef(translate[0] * translatefact, translate[1] * translatefact, translate[2] * translatefact); movingBox.render(factor); GL11.glTranslatef(-translate[0] * translatefact, -translate[1] * translatefact, -translate[2] * translatefact); bindTexture(chamberTexture); float chamberf = 2F / 16F; int chamberc = ((int) step + 4) / 2; for (int i = 0; i <= step + 2; i += 2) { chamber.render(factor); GL11.glTranslatef(translate[0] * chamberf, translate[1] * chamberf, translate[2] * chamberf); } GL11.glTranslatef(-translate[0] * chamberf * chamberc, -translate[1] * chamberf * chamberc, -translate[2] * chamberf * chamberc); bindTexture(trunkTexture); trunk.render(factor); GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:buildcraft.core.lib.gui.GuiAdvancedInterface.java
License:Minecraft Mod Public
protected void drawBackgroundSlots(int mouseX, int mouseY) { RenderHelper.enableGUIStandardItemLighting(); GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_TRANSFORM_BIT); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); int i1 = 240; int k1 = 240; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, i1 / 1.0F, k1 / 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); if (slots != null) { for (AdvancedSlot slot : slots) { if (slot != null) { slot.drawSprite(guiLeft, guiTop); drawSlotHighlight(slot, mouseX, mouseY); }//ww w . j ava 2 s . c o m } } GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:buildcraft.core.lib.gui.GuiBuildCraft.java
License:Minecraft Mod Public
/** * Draws the screen and all the components in it. *//*from w w w. j ava 2s . c o m*/ @Override public void drawScreen(int mouseX, int mouseY, float par3) { super.drawScreen(mouseX, mouseY, par3); int left = this.guiLeft; int top = this.guiTop; GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glPushMatrix(); GL11.glTranslatef(left, top, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); RenderHelper.disableStandardItemLighting(); InventoryPlayer playerInv = this.mc.thePlayer.inventory; if (playerInv.getItemStack() == null) { drawToolTips(container.getWidgets(), mouseX - left, mouseY - top, left, top); drawToolTips(buttonList, mouseX, mouseY, 0, 0); drawToolTips(inventorySlots.inventorySlots, mouseX, mouseY, 0, 0); } GL11.glPopMatrix(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); }
From source file:buildcraft.core.lib.render.RenderEntityBlock.java
License:Minecraft Mod Public
public void doRenderBlock(EntityBlock entity, double x, double y, double z) { if (entity.isDead) { return;// w ww . jav a 2 s. c om } shadowSize = entity.shadowSize; RenderInfo util = new RenderInfo(); util.textureArray = entity.texture; bindTexture(TextureMap.locationBlocksTexture); int iMax = (int) Math.ceil(entity.iSize) - 1; int jMax = (int) Math.ceil(entity.jSize) - 1; int kMax = (int) Math.ceil(entity.kSize) - 1; GL11.glTranslatef((float) x, (float) y, (float) z); for (int iBase = 0; iBase <= iMax; ++iBase) { for (int jBase = 0; jBase <= jMax; ++jBase) { for (int kBase = 0; kBase <= kMax; ++kBase) { util.renderSide[0] = jBase == 0; util.renderSide[1] = jBase == jMax; util.renderSide[2] = kBase == 0; util.renderSide[3] = kBase == kMax; util.renderSide[4] = iBase == 0; util.renderSide[5] = iBase == iMax; if (util.renderSide[0] || util.renderSide[1] || util.renderSide[2] || util.renderSide[3] || util.renderSide[4] || util.renderSide[5]) { util.minX = 0; util.minY = 0; util.minZ = 0; double remainX = entity.iSize - iBase; double remainY = entity.jSize - jBase; double remainZ = entity.kSize - kBase; util.maxX = remainX > 1.0 ? 1.0 : remainX; util.maxY = remainY > 1.0 ? 1.0 : remainY; util.maxZ = remainZ > 1.0 ? 1.0 : remainZ; GL11.glPushMatrix(); GL11.glRotatef(entity.rotationX, 1, 0, 0); GL11.glRotatef(entity.rotationY, 0, 1, 0); GL11.glRotatef(entity.rotationZ, 0, 0, 1); GL11.glTranslatef(iBase, jBase, kBase); renderBlock(util); GL11.glPopMatrix(); } } } } GL11.glTranslatef((float) -x, (float) -y, (float) -z); }
From source file:buildcraft.core.render.RenderBox.java
License:Minecraft Mod Public
public static void doRender(TextureManager t, ResourceLocation texture, Box box) { GL11.glPushMatrix(); GL11.glDisable(2896 /* GL_LIGHTING */); box.createLaserData();/* w w w. j a va 2 s .c o m*/ for (LaserData l : box.lasersData) { l.update(); GL11.glPushMatrix(); GL11.glTranslated(0.5F, 0.5F, 0.5F); RenderLaser.doRenderLaser(t, l, texture); GL11.glPopMatrix(); } GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); }
From source file:buildcraft.core.render.RenderBuilder.java
License:Minecraft Mod Public
@Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) { super.renderTileEntityAt(tileentity, x, y, z, f); TileAbstractBuilder builder = (TileAbstractBuilder) tileentity; if (builder != null) { GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND);/* w w w . j a v a 2 s . com*/ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glTranslated(x, y, z); GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord); if (builder.getPathLaser() != null) { for (LaserData laser : builder.getPathLaser()) { if (laser != null) { GL11.glPushMatrix(); RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.field_147553_e, laser, EntityLaser.LASER_TEXTURES[4]); GL11.glPopMatrix(); } } } //GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopAttrib(); GL11.glPopMatrix(); renderItems.render(tileentity, x, y, z); } }
From source file:buildcraft.core.render.RenderBuildingItems.java
License:Minecraft Mod Public
public void render(TileEntity tile, double x, double y, double z) { IBuildingItemsProvider provider = (IBuildingItemsProvider) tile; GL11.glPushMatrix(); GL11.glTranslated(x, y, z);//from w ww.ja va 2s . com GL11.glTranslated(-tile.xCoord, -tile.yCoord, -tile.zCoord); if (provider.getBuilders() != null) { for (BuildingItem i : provider.getBuilders()) { doRenderItem(i, 1.0F); } } GL11.glPopMatrix(); }
From source file:buildcraft.core.render.RenderBuildingItems.java
License:Minecraft Mod Public
private void doRenderItem(BuildingItem i, float light) { if (i == null) { return;/* w w w. j a va 2 s . c om*/ } i.displayUpdate(); for (StackAtPosition s : i.getStacks()) { if (s.display) { float renderScale = 0.7f; GL11.glPushMatrix(); GL11.glTranslatef((float) s.pos.x, (float) s.pos.y, (float) s.pos.z); GL11.glTranslatef(0, 0.25F, 0); GL11.glScalef(renderScale, renderScale, renderScale); dummyEntityItem.setEntityItemStack(s.stack); customRenderItem.doRender(dummyEntityItem, 0, 0, 0, 0, 0); GL11.glPopMatrix(); } } }