Example usage for org.lwjgl.opengl GL11 GL_MODELVIEW

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

Introduction

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

Prototype

int GL_MODELVIEW

To view the source code for org.lwjgl.opengl GL11 GL_MODELVIEW.

Click Source Link

Document

MatrixMode

Usage

From source file:stevekung.mods.moreplanets.planets.fronos.render.entities.RenderFronosCreeperBossTemp.java

License:Creative Commons License

protected int func_27006_a(EntityFronosCreeperBossTemp par1EntityCreeper, int par2, float par3) {
    if (par1EntityCreeper.isArmored()) {
        if (par2 == 1) {
            final float f1 = par1EntityCreeper.ticksExisted + par3;
            this.bindTexture(RenderFronosCreeperBossTemp.invulnerableCreeperTexture);
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();/*w w  w  .j  a  v a 2s  . co m*/
            final float f2 = f1 * 0.01F;
            final float f3 = f1 * 0.01F;
            GL11.glTranslatef(f2, f3, 0.0F);
            this.setRenderPassModel(this.mainModel);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glColor4f(0.5F, 0.5F, 0.5F, 1.0F);
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
            return 1;
        }
        if (par2 == 2) {
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glDisable(GL11.GL_BLEND);
        }
    } else if (!par1EntityCreeper.isArmored()) {
        if (par2 == 1) {
            final float f1 = par1EntityCreeper.ticksExisted + par3;
            this.bindTexture(RenderFronosCreeperBossTemp.powerTexture);
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();
            final float f2 = f1 * 0.01F;
            final float f3 = f1 * 0.01F;
            GL11.glTranslatef(f2, f3, 0.0F);
            this.setRenderPassModel(this.mainModel);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glColor4f(0.5F, 0.5F, 0.5F, 1.0F);
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
            return 1;
        }
        if (par2 == 2) {
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glDisable(GL11.GL_BLEND);
        }
    }
    return -1;
}

From source file:stevekung.mods.moreplanets.planets.siriusb.render.entities.RenderEvolvedSiriusBlazeBoss.java

License:Creative Commons License

protected int func_27006_a(EntityEvolvedSiriusBlazeBoss blaze, int par2, float par3) {
    if (par2 == 1) {
        if (blaze.getHealth() <= 32.0F) {
            float var4 = blaze.ticksExisted + par3;
            this.bindTexture(this.powerTexture);
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();/* ww w . ja v  a  2 s .  c o m*/
            float var5 = var4 * 0.01F;
            float var6 = var4 * 0.01F;
            GL11.glTranslatef(var5, var6, 0.0F);
            this.setRenderPassModel(this.mainModel);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glEnable(GL11.GL_BLEND);
            float var7 = 0.5F;
            GL11.glColor4f(var7, var7, var7, 1.0F);
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
            return 1;
        }
    }
    if (par2 == 2) {
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glLoadIdentity();
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_BLEND);
    }
    return -1;
}

From source file:taiga.gpvm.render.ColorEntityRenderer.java

License:Open Source License

@Override
public void render(Collection<Entity> ents, int pass, ReadableMatrix4 proj, ReadableMatrix4 modelview) {
    if (pass != HardcodedValues.OPAQUE_WORLD_LAYER)
        return;/*from  ww w.j  ava  2s.c  o  m*/

    ARBShaderObjects.glUseProgramObjectARB(0);
    GL11.glPointSize(size);

    FloatBuffer buffer = BufferUtils.createFloatBuffer(16);
    proj.store(buffer, false);
    buffer.flip();

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadMatrix(buffer);

    buffer.rewind();
    modelview.store(buffer, false);
    buffer.flip();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadMatrix(buffer);

    GL11.glBegin(GL11.GL_POINTS);

    for (Entity ent : ents) {
        ReadableVector3f loc = ent.getBounds().getCenter();
        GL11.glVertex3f(loc.getX(), loc.getY(), loc.getZ());
        GL11.glColor3f(red, green, blue);
    }

    GL11.glEnd();
}

From source file:taiga.mcmods.buildguide.BlockMarker.java

private void transformToPlayer() {
    FMLClientHandler ch = FMLClientHandler.instance();

    double x = ch.getClient().h.s;
    double y = ch.getClient().h.t;
    double z = ch.getClient().h.u;

    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    GL11.glPushMatrix();// w w w . java2 s  .  co m

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

From source file:tectonicus.rasteriser.lwjgl.LwjglRasteriser.java

License:BSD License

public void setCameraMatrix(Matrix4f matrix, Vector3f lookAt, Vector3f eye, Vector3f up) {
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();/*from   www.j  a v  a  2 s. c  om*/

    FloatBuffer buffer = BufferUtils.createFloatBuffer(16);
    matrix.store(buffer);
    buffer.flip();
    GL11.glLoadMatrix(buffer);
}

From source file:tectonicus.util.MatrixUtil.java

License:BSD License

public static void testLookAtMatrix(Vector3f eye, Vector3f center, Vector3f up) {
    // Make a lookat matrix in opengl and pull it out into a Matrix4f
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();//from   ww  w.  j a v  a2  s  .c o m
    GLU.gluLookAt(eye.x, eye.y, eye.z, center.x, center.y, center.z, up.x, up.y, up.z);

    FloatBuffer fromGlBuffer = BufferUtils.createFloatBuffer(16);
    GL11.glGetFloat(GL11.GL_MODELVIEW, fromGlBuffer);
    Matrix4f fromGl = new Matrix4f();
    fromGl.load(fromGlBuffer);

    Matrix4f manual = createLookAt(eye, center, up);

    compare(fromGl, manual);
}

From source file:tectonicus.util.MatrixUtil.java

License:BSD License

public static void testOrthoMatrix(final int left, final int right, final int bottom, final int top,
        final int near, final int far) {
    // Make an ortho matrix in opengl and pull it out into a Matrix4f
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();/*from w ww .j av a2 s .c  o  m*/
    GL11.glOrtho(left, right, bottom, top, near, far);
    FloatBuffer fromGlBuffer = BufferUtils.createFloatBuffer(16);
    GL11.glGetFloat(GL11.GL_MODELVIEW, fromGlBuffer);
    Matrix4f fromGl = new Matrix4f();
    fromGl.load(fromGlBuffer);

    Matrix4f manual = createOrthoMatrix(left, right, bottom, top, near, far);

    compare(fromGl, manual);
}

From source file:tk.jacklin213.voxelgale.rendering.BasicRenderer.java

License:Apache License

private void initGL() {
    GL11.glEnable(GL11.GL_TEXTURE_2D);//  w  ww. jav  a2s  .  c o m
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glClearColor(0, 0, 0, 0);
    GL11.glClearDepth(1);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();

    GLU.gluPerspective(45, (float) displayMode.getWidth() / (float) displayMode.getHeight(), 0.1f, 100);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
}

From source file:vazkii.botania.client.render.tile.RenderTileStarfield.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity p_147500_1_, double p_147500_2_, double p_147500_4_,
        double p_147500_6_, float p_147500_8_) {
    float f1 = (float) field_147501_a.field_147560_j;
    float f2 = (float) field_147501_a.field_147561_k;
    float f3 = (float) field_147501_a.field_147558_l;
    GL11.glDisable(GL11.GL_LIGHTING);/*from  w  ww.ja v a2  s. c  om*/
    field_147527_e.setSeed(31100L);
    float f4 = 0.24F;

    for (int i = 0; i < 16; ++i) {
        GL11.glPushMatrix();
        float f5 = 16 - i;
        float f6 = 0.0625F;
        float f7 = 1.0F / (f5 + 1.0F);

        if (i == 0) {
            bindTexture(field_147529_c);
            f7 = 0.1F;
            f5 = 65.0F;
            f6 = 0.125F;
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        }

        if (i == 1) {
            bindTexture(field_147526_d);
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
            f6 = 0.5F;
        }

        float f8 = (float) -(p_147500_4_ + f4);
        float f9 = f8 + ActiveRenderInfo.objectY;
        float f10 = f8 + f5 + ActiveRenderInfo.objectY;
        float f11 = f9 / f10;
        f11 += (float) (p_147500_4_ + f4);
        GL11.glTranslatef(f1, f11, f3);
        GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
        GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
        GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
        GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_EYE_LINEAR);
        GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, func_147525_a(1.0F, 0.0F, 0.0F, 0.0F));
        GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, func_147525_a(0.0F, 0.0F, 1.0F, 0.0F));
        GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, func_147525_a(0.0F, 0.0F, 0.0F, 1.0F));
        GL11.glTexGen(GL11.GL_Q, GL11.GL_EYE_PLANE, func_147525_a(0.0F, 1.0F, 0.0F, 0.0F));
        GL11.glEnable(GL11.GL_TEXTURE_GEN_S);
        GL11.glEnable(GL11.GL_TEXTURE_GEN_T);
        GL11.glEnable(GL11.GL_TEXTURE_GEN_R);
        GL11.glEnable(GL11.GL_TEXTURE_GEN_Q);
        GL11.glPopMatrix();
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glPushMatrix();
        GL11.glLoadIdentity();
        GL11.glTranslatef(0.0F, Minecraft.getSystemTime() % 20000L / 20000.0F, 0.0F);
        GL11.glScalef(f6, f6, f6);
        GL11.glTranslatef(0.5F, 0.5F, 0.0F);
        GL11.glRotatef((i * i * 4321 + i * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
        GL11.glTranslatef(-0.5F, -0.5F, 0.0F);
        GL11.glTranslatef(-f1, -f3, -f2);
        f9 = f8 + ActiveRenderInfo.objectY;
        GL11.glTranslatef(ActiveRenderInfo.objectX * f5 / f9, ActiveRenderInfo.objectZ * f5 / f9, -f2);
        Tessellator tessellator = Tessellator.instance;
        tessellator.startDrawingQuads();

        Color color = Color.getHSBColor(Minecraft.getSystemTime() / 20F % 360 / 360F, 1F, 1F);
        f11 = color.getRed() / 255F;
        float f12 = color.getGreen() / 255F;
        float f13 = color.getBlue() / 255F;

        tessellator.setColorRGBA_F(f11 * f7, f12 * f7, f13 * f7, 1.0F);
        tessellator.addVertex(p_147500_2_, p_147500_4_ + f4, p_147500_6_);
        tessellator.addVertex(p_147500_2_, p_147500_4_ + f4, p_147500_6_ + 1.0D);
        tessellator.addVertex(p_147500_2_ + 1.0D, p_147500_4_ + f4, p_147500_6_ + 1.0D);
        tessellator.addVertex(p_147500_2_ + 1.0D, p_147500_4_ + f4, p_147500_6_);
        tessellator.draw();
        GL11.glPopMatrix();
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
    }

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_S);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_T);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_R);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_Q);
    GL11.glEnable(GL11.GL_LIGHTING);
}

From source file:vazkii.quark.decoration.client.render.RenderTileCustomChest.java

License:Creative Commons License

@Override
public void renderTileEntityAt(TileCustomChest te, double x, double y, double z, float partialTicks,
        int destroyStage) {
    GlStateManager.enableDepth();//from w  w w  .  j a v  a  2s. c om
    GlStateManager.depthFunc(GL11.GL_LEQUAL);
    GlStateManager.depthMask(true);
    int meta;

    if (te.hasWorldObj()) {
        meta = te.getBlockMetadata();
        te.checkForAdjacentChests();
    } else
        meta = 0;

    if (te.adjacentChestZNeg == null && te.adjacentChestXNeg == null) {
        ModelChest model;

        if (te.adjacentChestXPos == null && te.adjacentChestZPos == null) {
            model = simpleChest;

            if (destroyStage >= 0) {
                bindTexture(DESTROY_STAGES[destroyStage]);
                GlStateManager.matrixMode(GL11.GL_TEXTURE);
                GlStateManager.pushMatrix();
                GlStateManager.scale(4.0F, 4.0F, 1.0F);
                GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
                GlStateManager.matrixMode(GL11.GL_MODELVIEW);
            } else
                bindTexture(te.chestType.nrmTex);
        } else {
            model = largeChest;

            if (destroyStage >= 0) {
                bindTexture(DESTROY_STAGES[destroyStage]);
                GlStateManager.matrixMode(GL11.GL_TEXTURE);
                GlStateManager.pushMatrix();
                GlStateManager.scale(8.0F, 4.0F, 1.0F);
                GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
                GlStateManager.matrixMode(GL11.GL_MODELVIEW);
            } else
                bindTexture(te.chestType.dblTex);
        }

        GlStateManager.pushMatrix();
        GlStateManager.enableRescaleNormal();

        if (destroyStage < 0)
            GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

        GlStateManager.translate(x, y + 1.0F, z + 1.0F);
        GlStateManager.scale(1.0F, -1.0F, -1.0F);
        GlStateManager.translate(0.5F, 0.5F, 0.5F);
        int angle = 0;

        if (meta == 2)
            angle = 180;

        if (meta == 3)
            angle = 0;

        if (meta == 4)
            angle = 90;

        if (meta == 5)
            angle = -90;

        if (meta == 2 && te.adjacentChestXPos != null) {
            GlStateManager.translate(1.0F, 0.0F, 0.0F);
        }

        if (meta == 5 && te.adjacentChestZPos != null) {
            GlStateManager.translate(0.0F, 0.0F, -1.0F);
        }

        GlStateManager.rotate(angle, 0.0F, 1.0F, 0.0F);
        GlStateManager.translate(-0.5F, -0.5F, -0.5F);
        float lidAngle = te.prevLidAngle + (te.lidAngle - te.prevLidAngle) * partialTicks;

        if (te.adjacentChestZNeg != null) {
            float adjLidAngle = te.adjacentChestZNeg.prevLidAngle
                    + (te.adjacentChestZNeg.lidAngle - te.adjacentChestZNeg.prevLidAngle) * partialTicks;

            if (adjLidAngle > lidAngle)
                lidAngle = adjLidAngle;
        }

        if (te.adjacentChestXNeg != null) {
            float adjLidAngle = te.adjacentChestXNeg.prevLidAngle
                    + (te.adjacentChestXNeg.lidAngle - te.adjacentChestXNeg.prevLidAngle) * partialTicks;

            if (adjLidAngle > lidAngle)
                lidAngle = adjLidAngle;
        }

        lidAngle = 1.0F - lidAngle;
        lidAngle = 1.0F - lidAngle * lidAngle * lidAngle;
        model.chestLid.rotateAngleX = -(lidAngle * ((float) Math.PI / 2F));
        model.renderAll();

        if (te.getChestType() == VariedChests.CUSTOM_TYPE_QUARK_TRAP) {
            if (model == simpleChest)
                bindTexture(VariedChests.TRAP_RESOURCE);
            else
                bindTexture(VariedChests.TRAP_DOUBLE_RESOURCE);

            GlStateManager.enableBlend();
            GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            GlStateManager.translate(0F, 0F, -0.001F);
            model.renderAll();
            GlStateManager.translate(0F, 0F, 0.001F);
            GlStateManager.disableBlend();
        }

        GlStateManager.disableRescaleNormal();
        GlStateManager.popMatrix();
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

        if (destroyStage >= 0) {
            GlStateManager.matrixMode(GL11.GL_TEXTURE);
            GlStateManager.popMatrix();
            GlStateManager.matrixMode(GL11.GL_MODELVIEW);
        }
    }
}