Example usage for org.lwjgl.opengl GL11 glTranslatef

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

Introduction

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

Prototype

public static native void glTranslatef(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y,
        @NativeType("GLfloat") float z);

Source Link

Document

Manipulates the current matrix with a translation matrix along the x-, y- and z- axes.

Usage

From source file:com.breckinloggins.DrawUtils.java

License:Open Source License

public static void drawQuad(float x, float y, int size, float rotation) {
    int halfSize = size / 2;

    GL11.glPushMatrix();/*from  w w  w . j ava2  s  .c  om*/
    {
        GL11.glTranslatef(x, y, 0);
        GL11.glRotatef(rotation, 0f, 0f, 1f);
        GL11.glTranslatef(-x, -y, 0);

        GL11.glBegin(GL11.GL_QUADS);
        {
            GL11.glVertex2f(x - halfSize, y - halfSize);
            GL11.glVertex2f(x + halfSize, y - halfSize);
            GL11.glVertex2f(x + halfSize, y + halfSize);
            GL11.glVertex2f(x - halfSize, y + halfSize);
        }
        GL11.glEnd();
    }
    GL11.glPopMatrix();
}

From source file:com.builtbroken.assemblyline.content.inserter.TileInsertArmClient.java

@Override
public void renderInventoryItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data) {
    GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
    GL11.glScaled(.8f, .8f, .8f);//from w w w.  jav  a  2  s .c o  m
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture);
    model.renderAll();
}

From source file:com.builtbroken.assemblyline.content.inserter.TileInsertArmClient.java

@Override
@SideOnly(Side.CLIENT)//from   w  w w  .  j  ava2 s.  com
public void renderDynamic(Pos pos, float deltaFrame, int pass) {
    if (ticks < 2) {
        renderAngle.set(rotation);
    } else {
        renderAngle.lerp(rotation, deltaFrame).clampTo360();
    }
    float yaw = (float) renderAngle.yaw();

    //Render inserter
    GL11.glPushMatrix();
    GL11.glTranslatef(pos.xf() + 0.5f, pos.yf() + 0.4f, pos.zf() + 0.5f);
    GL11.glRotated(yaw, 0, 1, 0);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture);
    model.renderAllExcept("Base", "BaseTop");
    GL11.glPopMatrix();

    //-----------------------------
    //Render item in hand
    GL11.glPushMatrix();
    GL11.glTranslated(pos.xf() + 0.5f, pos.yf() + 0.2f, pos.zf() + 0.5f);

    //Setup world position
    double x = renderAngle.x() * 1.15;
    double z = renderAngle.z() * 1.15;
    FakeItemRender.setWorldPosition(worldObj, xi() + 0.5 + x, yi() + 0.5, zi() + 0.5 + z);

    //Render actual item with rotation
    yaw += 90f;
    GL11.glRotatef(yaw, 0.0F, 1.0F, 0.0F);
    FakeItemRender.renderItemAtPosition(1, 0, 0, renderStack);
    GL11.glPopMatrix();
}

From source file:com.builtbroken.atomic.content.effects.client.RenderRadOverlay.java

@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent.Post event) {
    int width = event.resolution.getScaledWidth();
    int height = event.resolution.getScaledHeight();
    Minecraft mc = Minecraft.getMinecraft();

    if (event.type == RenderGameOverlayEvent.ElementType.ALL) {
        //Start/*from  w  w w . j a va2 s  . c o  m*/
        GL11.glPushMatrix();
        GL11.glTranslatef(0, 0, 0.0F);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDisable(GL11.GL_BLEND);

        //Position TODO config TODO fire event
        int left = 5;
        int top = 5;

        //Get data
        final float rad_player = interpolate(ClientProxy.PREV_RAD_PLAYER, ClientProxy.RAD_PLAYER,
                event.partialTicks);
        final float rad_area = interpolate(ClientProxy.PREV_RAD_EXPOSURE, ClientProxy.RAD_EXPOSURE,
                event.partialTicks);
        final float rad_dead_min = ConfigRadiation.RADIATION_DEATH_POINT / (60 * 20); //Radiation needed to die in 1 min

        //Format
        String remDisplay = formatDisplay("PER:", rad_player, "rem");
        String radDisplay = formatDisplay("ENV: ", rad_area * 20, "rem/s");

        //Render
        Render2DHelper.renderTextWithShadow(remDisplay, left, top,
                interpolate(startColor, endColor, rad_player / ConfigRadiation.RADIATION_DEATH_POINT).getRGB());
        Render2DHelper.renderTextWithShadow(radDisplay, left, top + 10,
                interpolate(startColor, endColor, rad_area / rad_dead_min).getRGB());

        if (AtomicScience.runningAsDev) {
            Render2DHelper.renderTextWithShadow("" + ClientProxy.RAD_REMOVE_TIMER, left + 60, top,
                    endColor.getRGB());
        }

        //Set prev
        ClientProxy.PREV_RAD_PLAYER = rad_player;
        ClientProxy.PREV_RAD_EXPOSURE = rad_area;

        //End
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glPopMatrix();
    }
}

From source file:com.builtbroken.atomic.content.machines.processing.boiler.render.RenderItemBoiler.java

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();/*from   www . j a  v  a 2s.c o m*/
    GL11.glScaled(0.0625f, 0.0625f, 0.0625f);
    if (type.equals(ItemRenderType.INVENTORY)) {
        GL11.glTranslatef(-0.5f, -0.8f, -0.5f);
        GL11.glRotatef(180f, 0, 1, 0);
    } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
        GL11.glRotatef(45f, 0, 1, 0);
        GL11.glTranslatef(1f, 12f, 9f);
    } else if (type.equals(ItemRenderType.EQUIPPED)) {
        GL11.glTranslatef(8f, 10f, 8f);
    }
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture_on);
    model_base.renderAll();
    model_core.renderAll();
    GL11.glPopMatrix();
}

From source file:com.builtbroken.atomic.content.machines.processing.centrifuge.render.RenderItemCentrifuge.java

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();/*from  w  ww.j a  va2s. c  o  m*/
    GL11.glScaled(0.0625f, 0.0625f, 0.0625f);
    if (type.equals(ItemRenderType.INVENTORY)) {
        GL11.glTranslatef(-0.5f, -0.8f, -0.5f);
        GL11.glRotatef(180f, 0, 1, 0);
    } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
        GL11.glRotatef(45f, 0, 1, 0);
        GL11.glTranslatef(1f, 12f, 9f);
    } else if (type.equals(ItemRenderType.EQUIPPED)) {
        GL11.glTranslatef(8f, 10f, 8f);
    }
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture);
    model_body.renderAll();
    model_core.renderAll();
    GL11.glPopMatrix();
}

From source file:com.builtbroken.atomic.content.machines.processing.extractor.render.RenderItemExtractor.java

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();//from  www. j a  va  2  s  .c om
    GL11.glScaled(0.0625f, 0.0625f, 0.0625f);
    if (type.equals(ItemRenderType.INVENTORY)) {
        GL11.glTranslatef(-0.5f, -0.8f, -0.5f);
        GL11.glRotatef(180f, 0, 1, 0);
    } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
        GL11.glRotatef(45f, 0, 1, 0);
        GL11.glTranslatef(1f, 12f, 9f);
    } else if (type.equals(ItemRenderType.EQUIPPED)) {
        GL11.glTranslatef(8f, 10f, 8f);
    }
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture);
    model_base.renderAll();
    model_drum.renderAll();
    GL11.glPopMatrix();
}

From source file:com.builtbroken.atomic.content.machines.reactor.fission.core.RenderItemReactor.java

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();/* w  w w  . j  a  v  a  2  s . co m*/
    GL11.glScaled(0.0625f, 0.0625f, 0.0625f);
    if (type.equals(ItemRenderType.INVENTORY)) {
        GL11.glTranslatef(-0.5f, -0.8f, -0.5f);
        GL11.glRotatef(180f, 0, 1, 0);
    } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
        GL11.glRotatef(45f, 0, 1, 0);
        GL11.glTranslatef(1f, 12f, 9f);
    } else if (type.equals(ItemRenderType.EQUIPPED)) {
        GL11.glTranslatef(8f, 10f, 8f);
    }
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture);
    model.renderAll();
    GL11.glPopMatrix();
}

From source file:com.builtbroken.atomic.content.machines.steam.generator.RenderItemSteamGenerator.java

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();/* w ww.  j  a  v  a2 s .c o  m*/
    if (type.equals(ItemRenderType.INVENTORY)) {
        GL11.glTranslatef(-0.5f, -1.1f, -0.5f);
        GL11.glScalef(1.4f, 1.4f, 1.4f);
    } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
        GL11.glTranslatef(0.5f, 0.2f, 0.5f);
    } else if (type.equals(ItemRenderType.EQUIPPED)) {
        GL11.glTranslatef(0.5f, 0.2f, 0.5f);
    }
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture);
    model.renderAll();
    GL11.glPopMatrix();
}

From source file:com.builtbroken.gascan.content.BucketMaterialCanClient.java

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();//from   ww w  .ja  va  2 s  .c  o m
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);

    if (type == ItemRenderType.EQUIPPED) {
        GL11.glRotatef(-40, 0, 1, 0);
        //GL11.glRotatef(13, 1, 0, 0);
        GL11.glTranslatef(1f, -1.1f, 0.1f);

        final float scale = 0.0625f / 4;
        GL11.glScalef(scale, scale, scale);
        MODEL.renderAll();
    } else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
        GL11.glRotatef(-90, 0, 1, 0);
        //GL11.glRotatef(-13, 1, 0, 0);
        GL11.glTranslatef(1f, 0.6f, 0.5f);

        final float scale = 0.0625f / 5;
        GL11.glScalef(scale, scale, scale);
        MODEL.renderAll();
    } else if (type == ItemRenderType.ENTITY) {
        GL11.glTranslatef(0f, 0, 0);

        final float scale = 0.0625f / 4;
        GL11.glScalef(scale, scale, scale);
        MODEL.renderAll();
    }

    GL11.glPopMatrix();
}