Example usage for org.lwjgl.opengl GL11 glTranslated

List of usage examples for org.lwjgl.opengl GL11 glTranslated

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glTranslated.

Prototype

public static native void glTranslated(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y,
        @NativeType("GLdouble") double z);

Source Link

Document

Double version of #glTranslatef Translatef .

Usage

From source file:com.minestellar.core.render.item.ComputerItemRender.java

License:Open Source License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    switch (type) {
    case ENTITY://  w  w w.  ja v a2 s.com
        GL11.glPushMatrix();
        GL11.glScaled(2, 2, 0);
        GL11.glTranslated(-0.5, 0, -0.5);
        TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityComputer(), 0.0D, 0.0D, 0.0D,
                0.0F);
        GL11.glTranslated(0.5, 0, 0.5);
        GL11.glPopMatrix();
        break;
    case EQUIPPED_FIRST_PERSON:
        GL11.glPushMatrix();
        GL11.glTranslated(0, 0.5, 0);
        TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityComputer(), 0.0D, 0.0D, 0.0D,
                0.0F);
        GL11.glPopMatrix();
        break;
    case INVENTORY:
        GL11.glPushMatrix();
        TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityComputer(), 0.0D, 0.0D, 0.0D,
                0.0F);
        GL11.glPopMatrix();
        break;
    }
}

From source file:com.minestellar.core.render.item.GasSinkItemRender.java

License:Open Source License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    switch (type) {
    case EQUIPPED_FIRST_PERSON:
        GL11.glPushMatrix();// w  w w.  ja  va2s.  c  o  m
        GL11.glTranslated(0, 0.25, 0);
        TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityGasSink(), 0.0D, 0.0D, 0.0D,
                0.0F);
        GL11.glTranslated(0, -0.25, 0);
        GL11.glPopMatrix();
        break;
    case INVENTORY:
        GL11.glPushMatrix();
        GL11.glTranslated(0, -0.1255, 0);
        TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityGasSink(), 0.0D, 0.0D, 0.0D,
                0.0F);
        GL11.glTranslated(0, 0.1255, 0);
        GL11.glPopMatrix();
        break;
    case ENTITY:
        GL11.glPushMatrix();
        GL11.glTranslated(-0.5, 0, -0.5);
        TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityGasSink(), 0.0D, 0.0D, 0.0D,
                0.0F);
        GL11.glTranslated(0.5, 0, 0.5);
        GL11.glPopMatrix();
    default:
        break;
    }
}

From source file:com.minestellar.core.render.item.OxygenCollectorItemRender.java

License:Open Source License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    switch (type) {
    case EQUIPPED_FIRST_PERSON:
        GL11.glPushMatrix();//w  w w .j a v  a 2 s .  com
        GL11.glTranslated(0, 0.25, 0);
        TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityOxygenCollector(), 0.0D, 0.0D,
                0.0D, 0.0F);
        GL11.glTranslated(0, -0.25, 0);
        GL11.glPopMatrix();
        break;
    case INVENTORY:
        GL11.glPushMatrix();
        GL11.glScaled(1.5, 1.5, 1.5);
        GL11.glTranslated(0, -0.1255, 0);
        TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityOxygenCollector(), 0.0D, 0.0D,
                0.0D, 0.0F);
        GL11.glTranslated(0, 0.1255, 0);
        GL11.glPopMatrix();
        break;
    case ENTITY:
        GL11.glPushMatrix();
        GL11.glTranslated(-0.5, 0, -0.5);
        TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityOxygenCollector(), 0.0D, 0.0D,
                0.0D, 0.0F);
        GL11.glTranslated(0.5, 0, 0.5);
        GL11.glPopMatrix();
    default:
        break;
    }
}

From source file:com.minestellar.core.render.item.PipeItemRender.java

License:Open Source License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    switch (type) {
    case EQUIPPED_FIRST_PERSON:
        GL11.glPushMatrix();/*from w ww.ja  va  2 s  .  c  om*/
        TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityPipe(meta), 0.0D, 0.0D, 0.0D,
                0.0F);
        GL11.glPopMatrix();
        break;
    case INVENTORY:
        GL11.glPushMatrix();
        GL11.glScaled(2, 2, 2);
        GL11.glTranslated(0, -0.1255, 0);
        TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityPipe(meta), 0.0D, 0.0D, 0.0D,
                0.0F);
        GL11.glTranslated(0, 0.1255, 0);
        GL11.glPopMatrix();
        break;
    case ENTITY:
        GL11.glPushMatrix();
        GL11.glScaled(2, 2, 2);
        GL11.glTranslated(-0.5, 0, -0.5);
        TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityPipe(meta), 0.0D, 0.0D, 0.0D,
                0.0F);
        GL11.glTranslated(0.5, 0, 0.5);
        GL11.glPopMatrix();
        break;
    default:
        break;
    }
}

From source file:com.minestellar.core.render.item.SolarGeneratorItemRender.java

License:Open Source License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    switch (type) {
    case EQUIPPED_FIRST_PERSON:
        GL11.glPushMatrix();/*  www.java 2  s. c o m*/
        GL11.glScaled(0.45D, 0.45D, 0.45D);
        GL11.glTranslated(0, 1, 0);
        TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntitySolarGenerator(), 0.0D, 0.0D,
                0.0D, 0.0F);
        GL11.glTranslated(0, -1, 0);
        GL11.glPopMatrix();
        break;
    case INVENTORY:
        GL11.glPushMatrix();
        GL11.glScaled(0.45D, 0.45D, 0.45D);
        GL11.glTranslated(0, -0.75, 0);
        TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntitySolarGenerator(), 0.0D, 0.0D,
                0.0D, 0.0F);
        GL11.glTranslated(0, 0.75, 0);
        GL11.glPopMatrix();
        break;
    case ENTITY:
        GL11.glPushMatrix();
        GL11.glTranslated(-0.5, 0, -0.5);
        TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntitySolarGenerator(), 0.0D, 0.0D,
                0.0D, 0.0F);
        GL11.glTranslated(0.5, 0, 0.5);
        GL11.glPopMatrix();
    default:
        break;
    }
}

From source file:com.mtbs3d.minecrift.VRRenderer.java

License:LGPL

/**
 * sets up projection, view effects, camera position/rotation
 *//*from  w  w  w. ja  va 2  s.com*/
private void setupCameraTransform(float renderPartialTicks, int renderSceneNumber) {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();

    if (renderSceneNumber == 0) {
        // Left eye
        FloatBuffer leftProj = eyeRenderParams.gl_getLeftProjectionMatrix();
        GL11.glLoadMatrix(leftProj);
        //mc.checkGLError("Set left projection");
    } else {
        // Right eye
        FloatBuffer rightProj = eyeRenderParams.gl_getRightProjectionMatrix();
        GL11.glLoadMatrix(rightProj);
        //mc.checkGLError("Set right projection");
    }
    float var5;

    if (this.mc.playerController != null && this.mc.playerController.enableEverythingIsScrewedUpMode()) {
        var5 = 0.6666667F;
        GL11.glScalef(1.0F, var5, 1.0F);
    }

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();

    //First, IPD transformation
    if (renderSceneNumber == 0) {
        // Left eye
        FloatBuffer leftEyeTransform = eyeRenderParams.gl_getLeftViewportTransform();
        GL11.glMultMatrix(leftEyeTransform);
    } else {
        // Right eye
        FloatBuffer rightEyeTransform = eyeRenderParams.gl_getRightViewportTransform();
        GL11.glMultMatrix(rightEyeTransform);
    }

    // Camera height offset
    float cameraYOffset = 1.62f
            - (this.mc.vrSettings.getPlayerEyeHeight() - this.mc.vrSettings.neckBaseToEyeHeight);

    EntityLivingBase entity = this.mc.renderViewEntity;
    if (entity != null) {
        //Do in-game camera adjustments if renderViewEntity exists
        //A few game effects
        this.hurtCameraEffect(renderPartialTicks);

        if (this.mc.gameSettings.viewBobbing) {
            this.setupViewBobbing(renderPartialTicks);
        }

        var5 = this.mc.thePlayer.prevTimeInPortal
                + (this.mc.thePlayer.timeInPortal - this.mc.thePlayer.prevTimeInPortal) * renderPartialTicks;

        if (var5 > 0.0F) {
            byte var6 = 20;

            if (this.mc.thePlayer.isPotionActive(Potion.confusion)) {
                var6 = 7;
            }

            float var7 = 5.0F / (var5 * var5 + 5.0F) - var5 * 0.04F;
            var7 *= var7;
            GL11.glRotatef(((float) this.rendererUpdateCount + renderPartialTicks) * (float) var6, 0.0F, 1.0F,
                    1.0F);
            GL11.glScalef(1.0F / var7, 1.0F, 1.0F);
            GL11.glRotatef(-((float) this.rendererUpdateCount + renderPartialTicks) * (float) var6, 0.0F, 1.0F,
                    1.0F);
        }

        if (this.mc.gameSettings.thirdPersonView > 0) {
            float thirdPersonCameraDist = this.thirdPersonDistanceTemp
                    + (this.thirdPersonDistance - this.thirdPersonDistanceTemp) * renderPartialTicks;
            float thirdPersonYaw;
            float thirdPersonPitch;

            if (this.mc.gameSettings.debugCamEnable) {
                thirdPersonYaw = this.prevDebugCamYaw
                        + (this.debugCamYaw - this.prevDebugCamYaw) * renderPartialTicks;
                thirdPersonPitch = this.prevDebugCamPitch
                        + (this.debugCamPitch - this.prevDebugCamPitch) * renderPartialTicks;
                GL11.glTranslatef(0.0F, 0.0F, (float) (-thirdPersonCameraDist));
                GL11.glRotatef(thirdPersonYaw, 1.0F, 0.0F, 0.0F);
                GL11.glRotatef(thirdPersonPitch, 0.0F, 1.0F, 0.0F);
            } else {
                thirdPersonYaw = cameraYaw;
                thirdPersonPitch = cameraPitch;

                if (this.mc.gameSettings.thirdPersonView == 2) {
                    thirdPersonPitch += 180.0F;
                }

                float PIOVER180 = (float) (Math.PI / 180);

                //For doing camera collision detection
                double camX = renderOriginX + camRelX;
                double camY = renderOriginY + camRelY - cameraYOffset;
                double camZ = renderOriginZ + camRelZ;

                float camXOffset = -MathHelper.sin(thirdPersonYaw * PIOVER180)
                        * MathHelper.cos(thirdPersonPitch * PIOVER180) * thirdPersonCameraDist;
                float camZOffset = MathHelper.cos(thirdPersonYaw * PIOVER180)
                        * MathHelper.cos(thirdPersonPitch * PIOVER180) * thirdPersonCameraDist;
                float camYOffset = -MathHelper.sin(thirdPersonPitch * PIOVER180) * thirdPersonCameraDist;

                thirdPersonCameraDist = checkCameraCollision(camX, camY, camZ, camXOffset, camYOffset,
                        camZOffset, thirdPersonCameraDist);

                if (this.mc.gameSettings.thirdPersonView == 2) {
                    GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
                }

                GL11.glRotatef(cameraPitch - thirdPersonPitch, 1.0F, 0.0F, 0.0F);
                GL11.glRotatef(cameraYaw - thirdPersonYaw, 0.0F, 1.0F, 0.0F);
                GL11.glTranslatef(0.0F, 0.0F, (float) (-thirdPersonCameraDist));
                GL11.glRotatef(thirdPersonYaw - cameraYaw, 0.0F, 1.0F, 0.0F);
                GL11.glRotatef(thirdPersonPitch - cameraPitch, 1.0F, 0.0F, 0.0F);
            }
        }
    }

    if (!this.mc.gameSettings.debugCamEnable) {
        //           if (this.mc.vrSettings.useQuaternions)
        //            {
        //                //GL11.glMultMatrix(cameraMatrix4f);   // This doesn't work currently - we still need
        //                                                     // the weird +180...
        //
        //                // So do this instead...
        //                float[] rawYawPitchRoll = OculusRift.getEulerAngles(orientation.x,
        //                        orientation.y,
        //                        orientation.z,
        //                        orientation.w,
        //                        1f,
        //                        OculusRift.HANDED_L,
        //                        OculusRift.ROTATE_CCW);
        //
        //                if (this.mc.gameSettings.thirdPersonView == 2)
        //                    GL11.glRotatef(-rawYawPitchRoll[2], 0.0F, 0.0F, 1.0F);
        //                else
        //                    GL11.glRotatef(rawYawPitchRoll[2], 0.0F, 0.0F, 1.0F);
        //
        //                GL11.glRotatef(rawYawPitchRoll[1], 1.0F, 0.0F, 0.0F);
        //                GL11.glRotatef(rawYawPitchRoll[0] + 180.0F, 0.0F, 1.0F, 0.0F);
        //            }
        //            else
        //            {
        if (this.mc.gameSettings.thirdPersonView == 2)
            GL11.glRotatef(-this.cameraRoll, 0.0F, 0.0F, 1.0F);
        else
            GL11.glRotatef(this.cameraRoll, 0.0F, 0.0F, 1.0F);

        GL11.glRotatef(this.cameraPitch, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(this.cameraYaw + 180.0F, 0.0F, 1.0F, 0.0F);
        //            }
    }

    GL11.glTranslated(-camRelX, cameraYOffset - camRelY, -camRelZ);

    if (this.debugViewDirection > 0) {
        int var8 = this.debugViewDirection - 1;

        if (var8 == 1) {
            GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
        }

        if (var8 == 2) {
            GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
        }

        if (var8 == 3) {
            GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
        }

        if (var8 == 4) {
            GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        }

        if (var8 == 5) {
            GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
        }
    }
}

From source file:com.owens.oobjloader.Main.java

License:BSD License

/**
 * Runs the program (the "main loop")/*  www  .jav a2s  .  c om*/
 */
private static void run(String filename, String defaultTextureMaterial) {
    DisplayModel scene = null;

    scene = new DisplayModel();

    log.log(INFO, "Parsing WaveFront OBJ file");
    Build builder = new Build();
    Parse obj = null;
    try {
        obj = new Parse(builder, filename);
    } catch (java.io.FileNotFoundException e) {
        log.log(SEVERE, "Exception loading object!  e=" + e);
        e.printStackTrace();
    } catch (java.io.IOException e) {
        log.log(SEVERE, "Exception loading object!  e=" + e);
        e.printStackTrace();
    }
    log.log(INFO, "Done parsing WaveFront OBJ file");

    log.log(INFO, "Splitting OBJ file faces into list of faces per material");
    ArrayList<ArrayList<Face>> facesByTextureList = createFaceListsByMaterial(builder);
    log.log(INFO, "Done splitting OBJ file faces into list of faces per material, ended up with "
            + facesByTextureList.size() + " lists of faces.");

    TextureLoader textureLoader = new TextureLoader();
    int defaultTextureID = 0;
    if (defaultTextureMaterial != null) {
        log.log(INFO, "Loading default texture =" + defaultTextureMaterial);
        defaultTextureID = setUpDefaultTexture(textureLoader, defaultTextureMaterial);
        log.log(INFO, "Done loading default texture =" + defaultTextureMaterial);
    }
    if (defaultTextureID == -1) {
        BufferedImage img = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB);
        Graphics g = img.getGraphics();
        g.setColor(Color.BLUE);
        g.fillRect(0, 0, 256, 256);
        g.setColor(Color.RED);
        for (int loop = 0; loop < 256; loop++) {
            g.drawLine(loop, 0, loop, 255);
            g.drawLine(0, loop, 255, loop);
        }
        defaultTextureID = textureLoader.convertToTexture(img);
    }
    int currentTextureID = -1;
    for (ArrayList<Face> faceList : facesByTextureList) {
        if (faceList.isEmpty()) {
            log.log(INFO, "ERROR: got an empty face list.  That shouldn't be possible.");
            continue;
        }
        log.log(INFO, "Getting material " + faceList.get(0).material);
        currentTextureID = getMaterialID(faceList.get(0).material, defaultTextureID, builder, textureLoader);
        log.log(INFO, "Splitting any quads and throwing any faces with > 4 vertices.");
        ArrayList<Face> triangleList = splitQuads(faceList);
        log.log(INFO, "Calculating any missing vertex normals.");
        calcMissingVertexNormals(triangleList);
        log.log(INFO, "Ready to build VBO of " + triangleList.size() + " triangles");
        ;

        if (triangleList.size() <= 0) {
            continue;
        }
        log.log(INFO, "Building VBO");

        VBO vbo = VBOFactory.build(currentTextureID, triangleList);

        log.log(INFO, "Adding VBO with text id " + currentTextureID + ", with " + triangleList.size()
                + " triangles to scene.");
        scene.addVBO(vbo);
    }
    log.log(INFO, "Finally ready to draw things.");

    GL11.glEnable(GL11.GL_CULL_FACE);

    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_LIGHT0);
    GL11.glEnable(GL11.GL_LIGHT1);

    float lightAmbient[] = { 1.0f, 1.0f, 1.0f, 1.0f };
    float lightDiffuse[] = { 0.5f, 0.5f, 1.0f, 1.0f };
    float lightSpecular[] = { 0.0f, 1.0f, 1.0f, 0.0f };

    GL11.glLight(GL11.GL_LIGHT0, GL11.GL_AMBIENT, asFloatBuffer(lightAmbient));
    GL11.glLight(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, asFloatBuffer(lightDiffuse));
    GL11.glLight(GL11.GL_LIGHT0, GL11.GL_SPECULAR, asFloatBuffer(lightSpecular));

    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_AMBIENT, asFloatBuffer(lightAmbient));
    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_DIFFUSE, asFloatBuffer(lightDiffuse));
    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_SPECULAR, asFloatBuffer(lightSpecular));

    float lightPosition0[] = { posix, posiy, posiz, 1.0f };
    GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, asFloatBuffer(lightPosition0));
    float lightPosition1[] = { posix, posiy, posizz, 1.0f };
    GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, asFloatBuffer(lightPosition1));

    while (!finished) {
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glLoadIdentity();

        GLU.gluLookAt(orix, oriy, oriz, cenx, ceny, cenz, 0, 1, 0);

        // rotate(based on camera)
        GL11.glRotatef(rotateSee, 0, 1, 0);
        GL11.glRotatef(rotateSeeAnother, 1, 0, 0);
        // transform
        GL11.glTranslated(0, -0.75, -2);
        // rotate(based on model)
        GL11.glRotatef(rotate, 0, 1, 0);
        GL11.glRotatef(rotateAnother, 1, 0, 0);

        // Always call Window.update(), all the time - it does some behind the
        // scenes work, and also displays the rendered output
        Display.update();

        // Check for close requests
        if (Display.isCloseRequested()) {
            finished = true;
        } // The window is in the foreground, so render!
        else if (Display.isActive()) {
            logic();
            GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT);
            scene.render();
            Display.sync(FRAMERATE);
        } // The window is not in the foreground, so we can allow other stuff to run and infrequently update
        else {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
            }
            logic();

            // Only bother rendering if the window is visible or dirty
            if (Display.isVisible() || Display.isDirty()) {
                System.err.print(".");
                scene.render();
            }
        }
    }
}

From source file:com.pahimar.ee3.client.renderer.tileentity.TileEntityAludelRenderer.java

License:LGPL

private void scaleTranslateRotate(double x, double y, double z, ForgeDirection orientation) {

    if (orientation == ForgeDirection.NORTH) {
        GL11.glTranslated(x + 1, y, z);
        GL11.glRotatef(180F, 0F, 1F, 0F);
        GL11.glRotatef(-90F, 1F, 0F, 0F);
    } else if (orientation == ForgeDirection.EAST) {
        GL11.glTranslated(x + 1, y, z + 1);
        GL11.glRotatef(90F, 0F, 1F, 0F);
        GL11.glRotatef(-90F, 1F, 0F, 0F);
    } else if (orientation == ForgeDirection.SOUTH) {
        GL11.glTranslated(x, y, z + 1);/*from w  w  w  .  j  av a2 s  .  c o  m*/
        GL11.glRotatef(0F, 0F, 1F, 0F);
        GL11.glRotatef(-90F, 1F, 0F, 0F);
    } else if (orientation == ForgeDirection.WEST) {
        GL11.glTranslated(x, y, z);
        GL11.glRotatef(-90F, 0F, 1F, 0F);
        GL11.glRotatef(-90F, 1F, 0F, 0F);
    }
}

From source file:com.pahimar.ee3.core.handlers.DrawBlockHighlightHandler.java

License:LGPL

public void drawInWorldTransmutationOverlay(DrawBlockHighlightEvent event) {

    double x = event.target.blockX + 0.5F;
    double y = event.target.blockY + 0.5F;
    double z = event.target.blockZ + 0.5F;
    double iPX = event.player.prevPosX + (event.player.posX - event.player.prevPosX) * event.partialTicks;
    double iPY = event.player.prevPosY + (event.player.posY - event.player.prevPosY) * event.partialTicks;
    double iPZ = event.player.prevPosZ + (event.player.posZ - event.player.prevPosZ) * event.partialTicks;
    int texture = event.context.renderEngine.getTexture(Textures.EFFECT_WORLD_TRANSMUTATION);

    float xScale = 1;
    float yScale = 1;
    float zScale = 1;
    float xShift = 0.1F;
    float yShift = 0.1F;
    float zShift = 0.1F;
    int chargeLevel;
    int itemChargeLevel = 0;

    if (event.currentItem.getItem() instanceof IChargeable) {
        itemChargeLevel = ((IChargeable) event.currentItem.getItem()).getCharge(event.currentItem);
    }//from   w ww  .  ja  va 2  s.co  m
    chargeLevel = 1 + itemChargeLevel * 2;

    ForgeDirection sideHit = ForgeDirection.getOrientation(event.target.sideHit);

    switch (sideHit) {
    case UP: {
        xScale = chargeLevel + 0.1F;
        zScale = chargeLevel + 0.1F;
        xShift = 0;
        zShift = 0;
        break;
    }
    case DOWN: {
        xScale = chargeLevel + 0.1F;
        zScale = chargeLevel + 0.1F;
        xShift = 0;
        yShift = -yShift;
        zShift = 0;
        break;
    }
    case NORTH: {
        xScale = chargeLevel + 0.1F;
        yScale = chargeLevel + 0.1F;
        xShift = 0;
        yShift = 0;
        zShift = -zShift;
        break;
    }
    case SOUTH: {
        xScale = chargeLevel + 0.1F;
        yScale = chargeLevel + 0.1F;
        xShift = 0;
        yShift = 0;
        break;
    }
    case EAST: {
        yScale = chargeLevel + 0.1F;
        zScale = chargeLevel + 0.1F;
        yShift = 0;
        zShift = 0;
        break;
    }
    case WEST: {
        yScale = chargeLevel + 0.1F;
        zScale = chargeLevel + 0.1F;
        xShift = -xShift;
        yShift = 0;
        zShift = 0;
        break;
    }
    default:
        break;
    }

    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_CULL_FACE);

    for (int i = 0; i < 6; i++) {
        ForgeDirection forgeDir = ForgeDirection.getOrientation(i);
        int zCorrection = i == 2 ? -1 : 1;
        GL11.glPushMatrix();
        GL11.glTranslated(-iPX + x + xShift, -iPY + y + yShift, -iPZ + z + zShift);
        GL11.glScalef(1F * xScale, 1F * yScale, 1F * zScale);
        GL11.glRotatef(90, forgeDir.offsetX, forgeDir.offsetY, forgeDir.offsetZ);
        GL11.glTranslated(0, 0, 0.5f * zCorrection);
        GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
        renderPulsingQuad(texture, 0.75F);
        GL11.glPopMatrix();
    }

    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDepthMask(true);
}

From source file:com.professorvennie.machinerycraft.client.renderer.tileentity.TileEntityRendererCable.java

License:Creative Commons License

@Override
public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float var8) {

    GL11.glTranslated(x, y, z);
    GL11.glDisable(GL11.GL_LIGHTING);/*from  ww  w. j  av  a2 s  .  c  o m*/
    this.bindTexture(texture);
    TileEntityCable cable = (TileEntityCable) entity;
    if (!cable.onlyOneOppsoite(cable.connections)) {
        RenderCenter();
        for (int i = 0; i < cable.connections.length; i++) {
            if (cable.connections[i] != null) {
                drawConnector(cable.connections[i]);
            }
        }
    } else {
        for (int i = 0; i < cable.connections.length; i++) {
            if (cable.connections[i] != null) {
                drawStriaght(cable.connections[i]);
                break;
            }
        }

    }
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glTranslated(-x, -y, -z);
}